1
wizanda
HELP! Fixing code, How to turn register globals off?
  • 2005/8/12 7:02

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Can someone who knows what they are doing, edited this code so register globals are off in the module? plz

function index() {
    global 
$xoopsConfig$xoopsDB$xoopsUser$xoopsTheme$xoopsLogger$xoopsModule$xoopsTpl$surano;
    include 
XOOPS_ROOT_PATH.'/header.php';
    
$myts =& MyTextSanitizer::getInstance();
    
searchform();
    echo 
"
"
;

     
$result mysql_query ("select sura, surano, ayatno, ayat from quran where ayatno=1 order by surano");
    echo 
"#D2F3CF">";
     
echo "center" width="25">"._MD_NO."left" width="175">"._MD_CHAPTERNAME."center" width="100">"._MD_VERSES."center" width="175">"._MD_LISTENDOWNLOAD."";
     while (list (
$sura,$surano,$ayat,$ayatno) = mysql_fetch_row ($result)) {
   
     
$result2 mysql_query ("select count(ayatno) from quran where surano=$surano");
     list (
$ayatcount) = mysql_fetch_row ($result2);
     
mysql_free_result ($result2);
     echo 
"#ffffff">";
     
echo "center" width="25">$surano.left" width="175">index.php?op=viewayat&surano=$surano">$suracenter" width="100">$ayatcountcenter" width="175">http://quran.al-islam.com/Recite/CRecite_g2.asp?s=$surano&f=$ayat&Reciter=1">$surano";
     
echo "";
 }
     echo 
"top">100%" colspan="4" align="center">";
    
    
developer(); 
 
    echo 
"";
    include 
'../../footer.php';
}

// Main Index Finished Here

// Search function


function search($query$min$show) {
    global 
$xoopsConfig$xoopsDB$xoopsUser$xoopsTheme$xoopsLogger$xoopsModule$xoopsTpl;

    if (!isset(
$min)) $min=0;
    if (!isset(
$max)) $max=$min+$perpage;

    
$perpage=10;

    
$searchresults=10;

    if (
$show!="") {
    
$searchresults=$show;
    } else {
    
$show=$searchresults;
    }
    
$query addslashes($query);
    
$result mysql_query("select ayat, sura, surano from quran where ayat LIKE '%$query%' OR sura LIKE '%$query%' limit  $min,$perpage");
    
$fullcountresult mysql_query("select id, sura, surano from quran where ayat LIKE '%$query%' ");

    
$totalselecteddownloads mysql_num_rows($fullcountresult);
    
$nrows  mysql_num_rows($fullcountresult);
    
$x=0;
    
$the_query stripslashes($query);
    
$the_query str_replace("'""'"$the_query);
    include 
XOOPS_ROOT_PATH.'/header.php';
    
$myts =& MyTextSanitizer::getInstance();
    echo 
"
"
;

    if (
$query != "") {

        if (
$nrows>0) {
    
    
searchform();
    echo 
"top">100%" colspan="4" align="center">option">"._MD_SEARCHRESULTS." : $the_query  "._MD_FOUND." : $nrows "._MD_VERSES.

"
;
    
    while(list(
$ayat,$ayatno,$sura,$surano) = mysql_fetch_row($result))
                  {
    
$ayat stripslashes($ayat);
    
$sura stripslashes($sura);
        
$ayat eregi_replace($query"background-color#FFFF00">$query", $ayat);

        
echo "left">$sura.$ayat";

        echo 
"
"
;
        
$sura ereg_replace($query"background-color#FFFF00">$query", $sura);
        
echo "
"
;
         
$x++;
                }
       echo 
"";

        }

       else {
        
searchform();
        echo 
"100%" colspan="4" align="center">

option">"._MD_NOMATCHESFOUND."

"
._MD_SEARCHAGAIN."
"
;
              
        }

      
/* Calculates how many pages exist.  Which page one should be on, etc... */
        
$quranpagesint = ($totalselecteddownloads $searchresults);
        
$downloadpageremainder = ($totalselecteddownloads $searchresults);
        if (
$downloadpageremainder != 0) {
            
$downloadpages ceil($quranpagesint);
            if (
$totalselecteddownloads $searchresults) {
                
$downloadpageremainder 0;
        }
        } else {
            
$downloadpages $quranpagesint;
        }
        
/* Page Numbering */
        
if ($downloadpages!=&& $downloadpages!=0) {
        echo 
"

"
            
.""._MD_SELECTPAGES.": ";
        
$prev=$min-$searchresults;
        if (
$prev>=0) {
                echo 
"  index.php?op=search&query=$the_query&min=$prev&show=$show">"
                
." << "._MD_PREVIOUS."
 ] "
;
              }
        
$counter 1;
            
$currentpage = ($max $searchresults);
            while (
$counter<=$downloadpages ) {
                
$cpage $counter;
                
$mintemp = ($perpage $counter) - $searchresults;
                if (
$counter == $currentpage) {
            echo 
"$counter "
;
            } else {
            echo 
"index.php?op=search&amp;query=$the_query&amp;min=$mintemp&amp;show=$show">$counter ";
            }
                
$counter++;
            }
            
$next=$min+$searchresults;
            if (
$x>=$perpage) {
                echo 
"  index.php?op=search&amp;query=$the_query&amp;min=$next&amp;show=$show">"
                
." "._MD_NEXT." >> ]
"
;
            }
    }
  }

else {
    
searchform();
    echo 
"4" width="100%" align="center">option">"._MD_FORGOTKEYWORDS."

"
;
       
        }
    echo 
"top">100%" colspan="4" align="center">";
    
developer();
    echo 
"";
    include 
'../../footer.php';
    
}

/********/

function choose() {

echo 
"top">100%" colspan="4" align="center">"._MD_BROWSECHAPTER.  surano" onChange="top.location.href=this.options[this.selectedIndex].value"> ";

echo 
""._MD_SELECTCHAPTER."";

    
$dropdown mysql_query("select sura, surano from quran where ayatno=1 ORDER BY surano");
    while (list(
$sura,$surano) = mysql_fetch_row($dropdown))
        {
        echo 
"$surano>$surano.$sura";
        }

echo 
"";

}

/********/

function searchform() {

echo 
"100%" cellspacing="0" cellpadding="10" border="0">";
echo 
"top">100%" colspan="4" align="center">n"
    
."

images/quran.gif" border="0" alt=""._MD_NOBLEQURAN."">

palatinogeorgiaverdanaarial">"._MD_NOBLEQURAN."

"
;


echo 
"top">100%" colspan="4" align="center">n"
    
."

index.php?op=search" method="post">n"
    
.""._MD_SEARCHQURAN.query" type=text>n"
    
."n"
    
."

"
;

echo 
"top">100%" colspan="4" align="center">n"
    
."

index.php?op=display" method="post">n"
    
.""._MD_CHAPTERNO.surano" type="text" maxLength="3" size="3">n"
    
." "._MD_VERSENO.ayatno" type="text" maxLength="4" size="3">n"
    
."n"
    
."

"
;

echo 
"top">100%" colspan="4" align="center">/">"._MD_HOME." | index.php">"._MD_QURANINDEX."
"
;

choose();

echo
"
"
;
}

// Search function finished

// Displaying ayat and surah

function display($surano,$ayatno) {

global 
$xoopsConfig$xoopsDB$xoopsUser$xoopsTheme$xoopsLogger$xoopsModule$xoopsTpl$surano$ayatno;
include 
XOOPS_ROOT_PATH.'/header.php';
$myts =& MyTextSanitizer::getInstance();
$result mysql_query("select sura, surano, ayat from quran where surano=$surano AND ayatno=$ayatno");
$resultar mysql_query("select ayat_ar from quran_ar where surano_ar=$surano AND ayatno_ar=$ayatno");

if(
$result!="") {

while(list(
$sura,$surano,$ayat) = mysql_fetch_row($result)) {

list(
$ayat_ar,$ayatno_ar,$id) = mysql_fetch_row($resultar) ;

searchform();

echo 
"top">100%" align="center">"._MD_DISPLAYING.": $sura ($surano)  "._MD_VERSENO.": $ayatno

"
;

echo 
"right">font-family:Simplified Arabic;font-size:20px" color=black>$ayat_ar  http://quran.al-islam.com/Recite/CRecite_g2.asp?s=$surano&f=$ayatno&Reciter=1">

 $surano.$ayat

";
     
}

}

else {
    echo 
"top">100%" align="center">option">"._MD_MENTIONNOCHAPTERORVERSE.

"
;

        echo 
"javascript:history.go(-1)">"._MD_TRYAGAIN."";

        }
    echo 
"top">100%" align="center">";
    
developer();
    echo 
"";
    include 
'../../footer.php';
 }

/********/

function viewayat($surano,$min,$show) {

   
$perpage=10;

    global 
$xoopsConfig$xoopsDB$xoopsUser$xoopsTheme$xoopsLogger$xoopsModule$xoopsTpl;
    include 
XOOPS_ROOT_PATH.'/header.php';
    
$myts =& MyTextSanitizer::getInstance();
    if (!isset(
$min)) $min=0;
    if (!isset(
$max)) $max=$min+$perpage;

    if (
$show!="") {
    
$perpage $show;
    } else {
    
$show=$perpage;
    }

    
searchform();

    
$resultx mysql_query("select id, sura, surano, ayatno, ayat from quran where surano=$surano limit $min,$perpage");
    
$fullcountresult mysql_query("select surano from quran where surano=$surano ORDER BY surano");
    
$totalayat mysql_num_rows($fullcountresult);
    echo 
"100%" cellspacing="0" cellpadding="10" border="0">content">";
    
$x=0;

    list(
$id,$sura,$surano,$ayatno,$ayat) = mysql_fetch_row($resultx);

    
$result2 mysql_query ("select count(ayatno) from quran where surano=$surano ");
    list (
$ayatcount) = mysql_fetch_row ($result2);
    if (
$ayatcount<10) {

    
$showstart=1;

    
$showend=$ayatcount;

    }
    else {

    
$showstart=$min+1;
    
$showend=$show+$min;

    }
  
$x++;

echo 
"

"._MD_CHAPTERNAME.": $sura "._MD_TOTALVERSES."$totalayat n"
    
.""._MD_DISPLAYING.": $showstart-$showend 
"
;

   if (
$ayatno<2) {

   echo
"
"
._MD_BISMILLAH."

"
;

   }

// Displaying Navbar at the top start

/* Calculates how many pages exist. Which page one should be on, etc... */
    
$audiopagesint = ($totalayat $perpage);
    
#global $surano; // I dont know why it does not work without this.

    
$audiopageremainder = ($totalayat $perpage);
    if (
$audiopageremainder != 0) {
        
$audiopages ceil($audiopagesint);
        if (
$totalayat $perpage) {
            
$audiopageremainder 0;
        }
    } else {
        
$audiopages $audiopagesint;
    }
    
/* Page Numbering */
    
if ($audiopages!=&& $audiopages!=0) {
        echo 
"
";
          echo 
"Select pages: ";
         
$prev=$min-$perpage;
         if (
$prev>=0) {
           
#echo "  ";
           #echo " < ]
 ";
      
}
        
$counter 1;
     
$currentpage = ($max $perpage);
           while (
$counter<=$audiopages ) {
              
$cpage $counter;
              
$mintemp = ($perpage $counter) - $perpage;
              if (
$counter == $currentpage) {

        echo 
"$counter ";

        } else {

        echo 
"index.php?op=viewayat&amp;surano=$surano&amp;min=$mintemp&amp;show=$show">$counter ";

        }
               
$counter++;

           }
         
$next=$min+$perpage;

         if (
$x>=$perpage) {
            echo 
"  index.php?op=viewayat&amp;surano=$surano&amp;min=$next&amp;show=$show">";
            
#echo ""._MD_Next." >> ]
 ";
         
}
    }
    echo 
"";


// Displaying Navbar at the top finished

   
$result mysql_query("select id, sura, surano, ayatno, ayat from quran where surano=$surano ORDER BY ayatno ASC limit  $min,$perpage");

   
$resultar mysql_query("select ayat_ar, surano_ar, ayatno_ar from quran_ar Where surano_ar=$surano ORDER BY ayatno_ar ASC limit $min,$perpage");

   while(list(
$id,$sura,$surano,$ayatno,$ayat)= mysql_fetch_row($result)) {

   list(
$ayat_ar,$ayatno_ar,$id) = mysql_fetch_row($resultar) ;

    
$sura=stripslashes($sura);
    
$ayat=stripslashes($ayat);
    
$ayat_ar=stripslashes($ayat_ar);
    
//  $ayatno_ar=$ayatno;
    //  echo"sura: $sura  Ayats: $ayatno
";
    
echo "right">font-family:Simplified Arabic;font-size:20px" color=black>$ayat_ar  http://quran.al-islam.com/Recite/CRecite_g2.asp?s=$surano&f=$id&Reciter=1">

$surano.$ayat

";

    
}

// added
   
    
developer();
    include 
'../../footer.php';
    
}

$op = isset($HTTP_GET_VARS['op']) ? trim($HTTP_GET_VARS['op']) : '';

// Displaying ayat and surah finished here

switch($op) {

    case 
"viewayat":
    
viewayat($surano,$min,$show);
    break;

    case 
"search";
    
search($query,$min,$show);
    break;

    case 
"display";
    
display($surano,$ayatno);
    break;

    case 
"choose":
    
choose();
    break;

    default:
    
index();
    break;

}


I need this for my website, yet since moving the new server has register globals off.

I have written to the original author twice, yet no reply.

So can someone on here, please edit this for me!!

Please!!

Login

Who's Online

440 user(s) are online (67 user(s) are browsing Support Forums)


Members: 0


Guests: 440


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits