Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> For Hire
Author Message
whatever72
New Member
New Member



Joined: Oct 24, 2012
Posts: 8

PostPosted: Wed Oct 24, 2012 5:39 am Reply with quote

Please can I receive a quote for rewriting this module.

Code:


<?php

/************************************************************************/
/*                                                                      */
/* Quran Module By Syed Mohammad Rasel                                  */
/* ===============================                                      */
/* version 1.0        30 August, 2002                                   */
/* http://www.nzmuslim.net [ Only registered users can see links on this board! Get registered or login! ] or [ Only registered users can see links on this board! Get registered or login! ]   */
/* Please do not sale it. KEEP IT FREE. DO NOT REMOVE MY INFORMATION.   */
/************************************************************************/
/* Ported to phpnuke 6.x by Tayeb [ Only registered users can see links on this board! Get registered or login! ]  13 August, 2003*/
/* Br Syed's version 1.0 plus worked only for phpnuke 5.x               */
/* Search code for keywords completely rewritten                        */     
/************************************************************************/

if (!eregi("modules.php", $PHP_SELF)) {
    die ("You can't access this file directly...");
}

$index = 1;

global $user, $cookie, $prefix, $dbi, $user_prefix;
$module_name = basename(dirname(__FILE__));


cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
    $username = "$ip";
    $guest = 1;
}

echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1256\">";
// This is not the right place to put...but anway.. it's working.. if u know  where how to do encoding pls suggest me

/********** devloper information*************/
function developer() {
    OPenTable();
       echo "<p align=\"center\">
       Quran Module version 1,2002<br>
      Developed by <a href=\"syedrasel@hotmail.com\">Syed Mohammad Rasel</a><br>
        Website: <a href=\"http://www.nzmuslim.net\">http://www.nzmuslim.net</a><br>
        Audio from <a href=\"http://www.islamway.com\">www.islamway.com</a><br><br>
      Ported to phpnuke 6.x by <a href=\"tayeb.habib@myiwc.com\">Tayeb Habib</a>";
      
    CloseTable();

    }

/************If you are a true muslim,please do not remove this copyright information.*****************/


/************************************************************************/
function index() {
    global $prefix, $dbi, $username,$surano;
    include("header.php");
   searchform();
    echo "<br>";


 $result = mysql_query ("select sura,surano,ayatno,ayat from quran where ayatno=1 order by surano ");
 OpenTable();

 echo "<tr bgcolor=\"#D2F3CF\">";
 echo "<td>No.</td><td>Name</td><td>Ayaats</td><td>listen(Real Audio)</td><td>Download(Mp3)</td></tr>";
 while (list ($sura,$surano,$ayat,$ayatno) = mysql_fetch_row ($result)) {

   $listen="0$surano.ram";
   $download="0$surano.mp3";

    if ($surano>99) {

    $listen="$surano.ram";
    $download="$surano.mp3";
    }


    if ($surano<10) {
    $listen="00$surano.ram";
    $download="00$surano.mp3";
    }


    $result2 = mysql_query ("select count(ayatno) from quran where surano=$surano");
    list ($ayatcount) = mysql_fetch_row ($result2);
    mysql_free_result ($result2);
    echo "<tr bgcolor=\"white\">";
    echo "<td>$surano.</td><td><a href=\"modules.php?name=Quran&amp;action=viewayat&amp;surano=$surano\">$sura</a></td><td>$ayatcount</td><td><center><a href=\"http://quran.islamway.com/agmy/$listen\">$surano<a/></center></td><td><center><a href=\"http://quran.islamway.com/agmy/$download\">$surano<a/></center></td>";
    echo "</tr>";
 }
 echo "</tr>";


    CloseTable();

    include("footer.php");
}


/********** new search *************/

function search($query) {

   global $prefix, $s, $dbi, $admin, $bgcolor2;
    //OpenTable();
   include("header.php");
   
   $var = addslashes($query);

    OpenTable();
   
    // Get the search variable from URL
 
    // $trimmed = trim($var); //trim whitespace from the stored variable

// rows to return
$limit=10;
   
// check for an empty string and display a message.
if ($var == "")
  {
  echo "<b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"option\">Please enter a search...</p>";
  exit;
  }

// check for a search parameter
if (!isset($var))
  {
  echo "<b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"option\">We dont seem to have a search parameter!</p>";
  exit;
  }



// Build SQL Query 
$query = "select ayat, ayatno, sura, surano from quran where ayat like \"%$var%\" OR sura like \"%$var%\""; // EDIT HERE and specify your table and field names for the SQL query


 $numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);

// If we have no results, offer a google search as an alternative

if ($numrows == 0)
  {
 
  echo "<h4>Results</h4>";
  echo "<p>Sorry, your search: &quot;" . $var . "&quot; returned zero results</p>";

// google

  }

// next determine if s has been passed to script, if not use 0
  if (empty($s)) {
  $s=0;
  }

// get results
  $query .= " limit $s,$limit";
  $result = mysql_query($query) or die("Couldn't execute query");

// display what the person searched for
echo "<p><b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"content\">Search Results for  :&nbsp;<b><i>$var</i></b></center></p>";
// echo "<p>You searched for: &quot;" . $var . "&quot;</p>";
// $the_query = stripslashes($query);
// $the_query = str_replace("\'", "'", $the_query);
// begin to show results set
CloseTable();
echo "<br>";


$count = 1 + $s ;

// now you can display the results returned
  while ($row= mysql_fetch_array($result)) {
  $surano = $row["surano"];
  $ayat = $row["ayat"];
  $ayat = eregi_replace($var, "<span style=\"background-color: #FFFF00\"><b>$var</b></span>", $ayat);
  $sura = $row["sura"];
  echo "$surano.$ayat<br><br>" ;
  $sura = ereg_replace($var, "<span style=\"background-color: #FFFF00\"><b>$var</b></span>", $sura);
  $count++ ;
  }

$currPage = (($s/$limit) + 1);

//break before paging
  echo "<br />";
OpenTable();
  // next we need to do the links to other results
  if ($s>=1) { // bypass PREV link if s is 0
  $prevs=($s-$limit);
  print "<center><a href=\"$PHP_SELF?name=Quran&file=index&action=search&s=$prevs&query=$var\">&lt;&lt;
  Prev 10</a>&nbsp&nbsp;";
  }

// calculate number of pages needing links
  $pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from division

  if ($numrows%$limit) {
  // has remainder so add one page
  $pages++;
  }

// check to see if last page
  if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

  // not last page so give NEXT link
  $news=$s+$limit;

  echo "&nbsp;<a href=\"$PHP_SELF?name=Quran&file=index&action=search&s=$news&query=$var\">Next 10 &gt;&gt;</a></center>";
  }

$a = $s + ($limit) ;
  if ($a > $numrows) { $a = $numrows ; }
  $b = $s + 1 ;
 

  echo "<p>Showing results $b to $a of $numrows</p>";
  // echo "</td></tr></table>";
  CloseTable(); 
 
     developer();
        
    include("footer.php");

}

/******************************/



function choose() {

echo"<b>Browse Sura </b>&nbsp;&nbsp;<select name=\"surano\" onChange=\"top.location.href=this.options[this.selectedIndex].value\"> ";

echo "<option value=>Select Sura</option>";

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


      echo "<option value=modules.php?name=Quran&amp;action=viewayat&amp;surano=$surano>$surano.$sura</option>";
      }

echo "</select></p>";



}




/**************** search form finished*****************/

function searchform() {
#global $query,$surano,$ayatno;
Opentable();
echo "<center><form action=\"modules.php?name=Quran&file=index&action=search\" method=\"post\">\n"
   ."Search in the Quran <input name=\"query\" type=text>\n"
   ."<input type=submit value=\"Search\">\n"
   ."<input type=hidden value=search name=search></form></center>";
echo"<center>";

echo"<hr>";

echo "<center><form action=\"modules.php?mop=modload&name=Quran&amp;file=index&action=display\" method=\"post\">\n"
   ."Sura number&nbsp;<input name=\"surano\" type=\"text\" maxLength=\"3\" size=\"3\">\n"
   ."Ayat number&nbsp;<input name=\"ayatno\" type=\"text\" maxLength=\"4\" size=\"3\">\n"
   ."<input type=submit value=\"Display\">\n"
   ."<input type=hidden value=display name=action></form></center>";
echo"<center>";
choose();

CloseTable();
echo"<br>";
}


/**************** search form finished*****************/



/************ displaying ayat and sura******************/

function display($surano,$ayatno) {
include("header.php");
global $prefix, $dbi,$surano,$ayatno;
OpenTable();
$result=sql_query("select sura,surano, ayat from quran where surano=$surano AND ayatno= $ayatno",$dbi);
$resultar = sql_query("select ayat_ar from quran_ar Where surano_ar=$surano AND ayatno_ar= $ayatno ", $dbi);

if($result!="") {

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

list($ayat_ar,$ayatno_ar,$id) = sql_fetch_row($resultar, $dbi) ;

searchform();

echo" <strong>Displaying:</strong> $sura($surano) &nbsp;Ayat No:&nbsp;<b>$ayatno</b><br><br>";

echo"<font style=\"font-family:Simplified Arabic;font-size:18px\" color=black>$ayat_ar</font><br> $surano.$ayat";
     }

}

else {
   echo "<center><font class=\"option\"><b>You didn't mention Sura or Ayat Number to Find </b></font><br><br>";

        echo "<A HREF=\"javascript:history.go(-1)\">Go Back and type keywords to search</A></center>";

        }
    CloseTable();
developer();

include("footer.php");

 }


function makepagelink($link, $page, $pages) {
   $page_link = "<b>[";
   if($page!=1) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=1\">&laquo;</a>&nbsp;&nbsp;<a href=\"$link&page=".($page-1)."\">First</a>";
   if($page>=6) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page-5)."\">...</a>";
   if($page+4>=$pages) $pagex=$pages;
   else $pagex=$page+4;
   for($i=$page-4 ; $i<=$pagex ; $i++) {
      if($i<=0) $i=1;
      if($i==$page) $page_link .= "&nbsp;&nbsp;$i";
      else $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=$i\">$i</a>";
   }
   if(($pages-$page)>=5) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page+5)."\">...</a>";
   if($page!=$pages) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page+1)."\">›</a>&nbsp;&nbsp;<a href=\"$link&page=".$pages."\">Last</a>";
   $page_link .= "&nbsp;&nbsp;]</b>";

   return $page_link;
}


/************ displaying ayat and sura finished******************/


function viewayat($surano) {
   global $dbi,$module_name;
   include("header.php");

   $result2 = mysql_query ("select id from quran where surano=$surano ",$dbi);
   $num_record=mysql_num_rows($result2);

     if(isset($_GET['page']))
   $page=intval($_GET['page']);
   else $page=1;

   $currentpage=$page;

   $perpage =10;
   $start=($page-1) * $perpage;
   $pages=ceil($num_record/$perpage);

   $starting_no = $start + 1;

   if ($num_record - $start<$perpage) {
      $end_count = $num_record;
   } elseif ($num_record - $start >= $perpage) {
      $end_count = $start + $perpage;
   }

   if($pages>1)
   $page_link = makepagelink("modules.php?name=Quran&action=viewayat&amp;surano=$surano", $page, $pages);
   else
   $page_link = "";
   echo "<center><form action=\"modules.php?name=Quran&file=index&action=search\" method=\"post\">\n"
      ."Search in the Quran <input name=\"query\" type=text>\n"
      ."<input type=submit value=\"Search\">\n"
      ."<input type=hidden value=search name=search></form></center>";
   echo"<center>";


   //searchform();

    $resultx=mysql_query("select id,sura,surano,ayatno,ayat from quran where surano=$surano  limit  $start,$perpage ", $dbi);
    #$fullcountresult=sql_query("select surano from quran where surano=$surano  ORDER BY `surano` ASC", $dbi);
    #$totalayat = sql_num_rows($fullcountresult, $dbi);
   //opentable();
    list($id,$sura,$surano, $ayatno, $ayat)=sql_fetch_row($resultx, $dbi);

   echo"<table cellSpacing=0 cellPadding=0 width=100% border=0>
   <tr>
   <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
   </tr>
   <tr>
   <td vAlign=top align=left>
   <p align=left><a href=\"modules.php?name=$module_name\">Index</a> |$sura |$starting_no-$end_count of $num_record  ayats » Page $currentpage/$pages</td>
   <td width=20>&nbsp;</td>
   <td vAlign=top align=right>
   <p align=right>";
   echo"$page_link";
   echo"</td>
   </tr>
   <tr>
   <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
   </tr>
   </table>";
   openTable();
   echo "<center><form action=\"modules.php?mop=modload&name=Quran&amp;file=index&action=display\" method=\"post\">\n"
      ."Sura number&nbsp;<input name=\"surano\" type=\"text\" maxLength=\"3\" size=\"3\">\n"
      ."Ayat number&nbsp;<input name=\"ayatno\" type=\"text\" maxLength=\"4\" size=\"3\">\n"
      ."<input type=submit value=\"Display\">\n"
      ."<input type=hidden value=display name=action></form></center>";
   echo"<center>";
   choose();
   closeTable();
   if ($ayatno<2) {

   echo"<h5><center><u>In the name of Allah ,Most Gracious, Most Merciful</u></center></h5>";

   }
   echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">";

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

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

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

   list($ayat_ar,$ayatno_ar,$id) = sql_fetch_row($resultar, $dbi) ;


   $sura= stripslashes($sura);

   $ayat = stripslashes($ayat);
   $ayat_ar=stripslashes($ayat_ar);
    # $ayatno_ar=$ayatno;
    #echo"sura:&nbsp;$sura &nbsp;Ayats:&nbsp;$ayatno<br>";
   echo "<font style=\"font-family:Simplified Arabic;font-size:18px\" color=black>$ayat_ar<a/></font><br>$surano.$ayat<br><hr class=\"line\" width=\"98%\" noShade SIZE=\"1\"><br>";

    }
echo "</td></tr></table>";
//closetable();

developer();

    include("footer.php");
}


/************************************************************************/
switch($action) {


    case "viewayat":
    viewayat($surano);
    break;

    case "search";
    search($query);
    break;


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

    case "choose":
   choose();
    break;

    default:
    index();
    break;

}


?>
 
View user's profile Send private message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1122

PostPosted: Wed Oct 24, 2012 6:23 am Reply with quote

Try this. I do know it is not complete since I don't know if you are using RavenNuke. Let me know.

Code:



<?php

/************************************************************************/
/*                                                                      */
/* Quran Module By Syed Mohammad Rasel                                  */
/* ===============================                                      */
/* version 1.0        30 August, 2002                                   */
/* http://www.nzmuslim.net [ Only registered users can see links on this board! Get registered or login! ] or [ Only registered users can see links on this board! Get registered or login! ]   */
/* Please do not sale it. KEEP IT FREE. DO NOT REMOVE MY INFORMATION.   */
/************************************************************************/
/* Ported to phpnuke 6.x by Tayeb [ Only registered users can see links on this board! Get registered or login! ]  13 August, 2003*/
/* Br Syed's version 1.0 plus worked only for phpnuke 5.x               */
/* Search code for keywords completely rewritten                        */     
/************************************************************************/

if (!defined('MODULE_FILE')) die('You can\'t access this file directly...');

$index = 0;
if (!defined('INDEX_FILE')) define('INDEX_FILE', true); // Set to FALSE to hide right blocks
if (defined('INDEX_FILE') AND INDEX_FILE === true) {
   // auto set right blocks for pre patch 3.1 compatibility
   $index = 1;
}

$module_name = basename(dirname(__FILE__));


cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
    $username = "$ip";
    $guest = 1;
}

echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1256\">";
// This is not the right place to put...but anway.. it's working.. if u know  where how to do encoding pls suggest me

/********** devloper information*************/
function developer() {
    OPenTable();
       echo "<p align=\"center\">
       Quran Module version 1,2002<br>
      Developed by <a href=\"syedrasel@hotmail.com\">Syed Mohammad Rasel</a><br>
        Website: <a href=\"http://www.nzmuslim.net\">http://www.nzmuslim.net</a><br>
        Audio from <a href=\"http://www.islamway.com\">www.islamway.com</a><br><br>
      Ported to phpnuke 6.x by <a href=\"tayeb.habib@myiwc.com\">Tayeb Habib</a>";
     
    CloseTable();

    }

/************If you are a true muslim,please do not remove this copyright information.*****************/


/************************************************************************/
function index() {
    global $prefix, $db, $username,$surano;
    include("header.php");
   searchform();
    echo "<br />";


 $result = $db->sql_query ("select sura,surano,ayatno,ayat from quran where ayatno=1 order by surano ");
 OpenTable();

 echo "<tr bgcolor=\"#D2F3CF\">";
 echo "<td>No.</td><td>Name</td><td>Ayaats</td><td>listen(Real Audio)</td><td>Download(Mp3)</td></tr>";
 while (list ($sura,$surano,$ayat,$ayatno) = $db->sql_fetchrow ($result)) {

   $listen="0$surano.ram";
   $download="0$surano.mp3";

    if ($surano>99) {

    $listen="$surano.ram";
    $download="$surano.mp3";
    }


    if ($surano<10) {
    $listen="00$surano.ram";
    $download="00$surano.mp3";
    }


    $result2 = $db->sql_query ("select count(ayatno) from quran where surano=$surano");
    list ($ayatcount) = $db->sql_fetchrow ($result2);
    $db->sql_freeresult ($result2);
    echo "<tr bgcolor=\"white\">";
    echo "<td>$surano.</td><td><a href=\"modules.php?name=Quran&amp;action=viewayat&amp;surano=$surano\">$sura</a></td><td>$ayatcount</td><td><center><a href=\"http://quran.islamway.com/agmy/$listen\">$surano<a/></center></td><td><center><a href=\"http://quran.islamway.com/agmy/$download\">$surano<a/></center></td>";
    echo "</tr>";
 }
 echo "</tr>";


    CloseTable();

    include("footer.php");
}


/********** new search *************/

function search($query) {

   global $prefix, $s, $db, $admin, $bgcolor2;
    //OpenTable();
   include("header.php");
   
   $var = addslashes($query);

    OpenTable();
   
    // Get the search variable from URL
 
    // $trimmed = trim($var); //trim whitespace from the stored variable

// rows to return
$limit=10;
   
// check for an empty string and display a message.
if ($var == "")
  {
  echo "<b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"option\">Please enter a search...</p>";
  exit;
  }

// check for a search parameter
if (!isset($var))
  {
  echo "<b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"option\">We dont seem to have a search parameter!</p>";
  exit;
  }



// Build SQL Query
$query = "select ayat, ayatno, sura, surano from quran where ayat like \"%$var%\" OR sura like \"%$var%\""; // EDIT HERE and specify your table and field names for the SQL query


 $numresults=$db->sql_query($query);
 $numrows=$db->sql_numrows($numresults);

// If we have no results, offer a google search as an alternative

if ($numrows == 0)
  {
 
  echo "<h4>Results</h4>";
  echo "<p>Sorry, your search: &quot;" . $var . "&quot; returned zero results</p>";

// google

  }

// next determine if s has been passed to script, if not use 0
  if (empty($s)) {
  $s=0;
  }

// get results
  $query .= " limit $s,$limit";
  $result = $db->sql_query($query) or die("Couldn't execute query");

// display what the person searched for
echo "<p><b><a href=modules.php?name=Quran>Home</a>::</b><center><font class=\"content\">Search Results for  :&nbsp;<b><i>$var</i></b></center></p>";
// echo "<p>You searched for: &quot;" . $var . "&quot;</p>";
// $the_query = stripslashes($query);
// $the_query = str_replace("\'", "'", $the_query);
// begin to show results set
CloseTable();
echo "<br / >";


$count = 1 + $s ;

// now you can display the results returned
  while ($row= $db->sql_fetchrow($result)) {
  $surano = $row["surano"];
  $ayat = $row["ayat"];
  $ayat = preg_replace($var, "<span style=\"background-color: #FFFF00\"><b>$var</b></span>", $ayat);
  $sura = $row["sura"];
  echo "$surano.$ayat<br><br>" ;
  $sura = preg_replace($var, "<span style=\"background-color: #FFFF00\"><b>$var</b></span>", $sura);
  $count++ ;
  }

$currPage = (($s/$limit) + 1);

//break before paging
  echo "<br />";
OpenTable();
  // next we need to do the links to other results
  if ($s>=1) { // bypass PREV link if s is 0
  $prevs=($s-$limit);
  print "<center><a href=\"$PHP_SELF?name=Quran&file=index&action=search&s=$prevs&query=$var\">&lt;&lt;
  Prev 10</a>&nbsp&nbsp;";
  }

// calculate number of pages needing links
  $pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from division

  if ($numrows%$limit) {
  // has remainder so add one page
  $pages++;
  }

// check to see if last page
  if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

  // not last page so give NEXT link
  $news=$s+$limit;

  echo "&nbsp;<a href=\"$PHP_SELF?name=Quran&file=index&action=search&s=$news&query=$var\">Next 10 &gt;&gt;</a></center>";
  }

$a = $s + ($limit) ;
  if ($a > $numrows) { $a = $numrows ; }
  $b = $s + 1 ;
 

  echo "<p>Showing results $b to $a of $numrows</p>";
  // echo "</td></tr></table>";
  CloseTable();
 
     developer();
       
    include("footer.php");

}

/******************************/



function choose() {

echo"<b>Browse Sura </b>&nbsp;&nbsp;<select name=\"surano\" onChange=\"top.location.href=this.options[this.selectedIndex].value\"> ";

echo "<option value=>Select Sura</option>";

   $dropdown=$db->sql_query("select sura, surano from quran where ayatno=1 ORDER BY surano ASC");
   while (list($sura, $surano) = $db->sql_fetchrow($dropdown))
      {


      echo "<option value=modules.php?name=Quran&amp;action=viewayat&amp;surano=$surano>$surano.$sura</option>";
      }

echo "</select></p>";



}




/**************** search form finished*****************/

function searchform() {
#global $query,$surano,$ayatno;
Opentable();
echo "<center><form action=\"modules.php?name=Quran&file=index&action=search\" method=\"post\">\n"
   ."Search in the Quran <input name=\"query\" type=text />\n"
   ."<input type=submit value=\"Search\" />\n"
   ."<input type=hidden value=search name=search /></form></center>";
echo"<center>";

echo"<hr />";

echo "<center><form action=\"modules.php?mop=modload&name=Quran&amp;file=index&action=display\" method=\"post\">\n"
   ."Sura number&nbsp;<input name=\"surano\" type=\"text\" maxLength=\"3\" size=\"3\">\n"
   ."Ayat number&nbsp;<input name=\"ayatno\" type=\"text\" maxLength=\"4\" size=\"3\">\n"
   ."<input type=submit value=\"Display\" />\n"
   ."<input type=hidden value=display name=action /></form></center>";
echo"<center>";
choose();

CloseTable();
echo"<br>";
}


/**************** search form finished*****************/



/************ displaying ayat and sura******************/

function display($surano,$ayatno) {
include("header.php");
global $prefix, $db,$surano,$ayatno;
OpenTable();
$result=$db->sql_query("select sura,surano, ayat from quran where surano=$surano AND ayatno= $ayatno",$db);
$resultar = $db->sql_query("select ayat_ar from quran_ar Where surano_ar=$surano AND ayatno_ar= $ayatno ", $db);

if($result!="") {

while(list($sura,$surano,$ayat)=$db->sql_fetchrow($result)) {

list($ayat_ar,$ayatno_ar,$id) = $db->sql_fetchrow($resultar, $db) ;

searchform();

echo" <strong>Displaying:</strong> $sura($surano) &nbsp;Ayat No:&nbsp;<b>$ayatno</b><br /><br />";

echo"<font style=\"font-family:Simplified Arabic;font-size:18px\" color=black>$ayat_ar</font><br> $surano.$ayat";
     }

}

else {
   echo "<center><font class=\"option\"><b>You didn't mention Sura or Ayat Number to Find </b></font><br /><br />";

        echo "<a href=\"javascript:history.go(-1)\">Go Back and type keywords to search</a></center>";

        }
    CloseTable();
developer();

include("footer.php");

 }


function makepagelink($link, $page, $pages) {
   $page_link = "<b>[";
   if($page!=1) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=1\">&laquo;</a>&nbsp;&nbsp;<a href=\"$link&page=".($page-1)."\">First</a>";
   if($page>=6) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page-5)."\">...</a>";
   if($page+4>=$pages) $pagex=$pages;
   else $pagex=$page+4;
   for($i=$page-4 ; $i<=$pagex ; $i++) {
      if($i<=0) $i=1;
      if($i==$page) $page_link .= "&nbsp;&nbsp;$i";
      else $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=$i\">$i</a>";
   }
   if(($pages-$page)>=5) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page+5)."\">...</a>";
   if($page!=$pages) $page_link .= "&nbsp;&nbsp;<a href=\"$link&page=".($page+1)."\">›</a>&nbsp;&nbsp;<a href=\"$link&page=".$pages."\">Last</a>";
   $page_link .= "&nbsp;&nbsp;]</b>";

   return $page_link;
}


/************ displaying ayat and sura finished******************/


function viewayat($surano) {
   global $db,$module_name;
   include("header.php");

   $result2 = $db->sql_query ("select id from quran where surano=$surano ",$db);
   $num_record=$db->sql_numrows($result2);

     if(isset($_GET['page']))
   $page=intval($_GET['page']);
   else $page=1;

   $currentpage=$page;

   $perpage =10;
   $start=($page-1) * $perpage;
   $pages=ceil($num_record/$perpage);

   $starting_no = $start + 1;

   if ($num_record - $start<$perpage) {
      $end_count = $num_record;
   } elseif ($num_record - $start >= $perpage) {
      $end_count = $start + $perpage;
   }

   if($pages>1)
   $page_link = makepagelink("modules.php?name=Quran&action=viewayat&amp;surano=$surano", $page, $pages);
   else
   $page_link = "";
   echo "<center><form action=\"modules.php?name=Quran&file=index&action=search\" method=\"post\">\n"
      ."Search in the Quran <input name=\"query\" type=text>\n"
      ."<input type=submit value=\"Search\" />\n"
      ."<input type=hidden value=search name=search /></form></center>";
   echo"<center>";


   //searchform();

    $resultx=$db->sql_query("select id,sura,surano,ayatno,ayat from quran where surano=$surano  limit  $start,$perpage ", $db);
    #$fullcountresult=sql_query("select surano from quran where surano=$surano  ORDER BY `surano` ASC", $dbi);
    #$totalayat = sql_num_rows($fullcountresult, $dbi);
   //opentable();
    list($id,$sura,$surano, $ayatno, $ayat)=$db->sql_fetchrow($resultx, $db);

   echo"<table cellSpacing=0 cellPadding=0 width=100% border=0>
   <tr>
   <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
   </tr>
   <tr>
   <td vAlign=top align=left>
   <p align=left><a href=\"modules.php?name=$module_name\">Index</a> |$sura |$starting_no-$end_count of $num_record  ayats » Page $currentpage/$pages</td>
   <td width=20>&nbsp;</td>
   <td vAlign=top align=right>
   <p align=right>";
   echo"$page_link";
   echo"</td>
   </tr>
   <tr>
   <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
   </tr>
   </table>";
   openTable();
   echo "<center><form action=\"modules.php?mop=modload&name=Quran&amp;file=index&action=display\" method=\"post\">\n"
      ."Sura number&nbsp;<input name=\"surano\" type=\"text\" maxLength=\"3\" size=\"3\">\n"
      ."Ayat number&nbsp;<input name=\"ayatno\" type=\"text\" maxLength=\"4\" size=\"3\">\n"
      ."<input type=submit value=\"Display\" />\n"
      ."<input type=hidden value=display name=action /></form></center>";
   echo"<center>";
   choose();
   closeTable();
   if ($ayatno<2) {

   echo"<h5><center><u>In the name of Allah ,Most Gracious, Most Merciful</u></center></h5>";

   }
   echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">";

   $result=$db->sql_query("select id,sura,surano,ayatno,ayat from quran where surano=$surano ORDER BY ayatno ASC limit  $start,$perpage ", $db);

     $resultar = $db->sql_query("select ayat_ar,surano_ar,ayatno_ar from quran_ar Where surano_ar=$surano ORDER BY ayatno_ar ASC limit  $start,$perpage ", $db);

   while(list($id,$sura,$surano, $ayatno, $ayat)=$db->sql_fetchrow($result, $db)) {

   list($ayat_ar,$ayatno_ar,$id) = $db->sql_fetchrow($resultar, $db) ;


   $sura= stripslashes($sura);

   $ayat = stripslashes($ayat);
   $ayat_ar=stripslashes($ayat_ar);
    # $ayatno_ar=$ayatno;
    #echo"sura:&nbsp;$sura &nbsp;Ayats:&nbsp;$ayatno<br>";
   echo "<font style=\"font-family:Simplified Arabic;font-size:18px\" color=black>$ayat_ar<a/></font><br>$surano.$ayat<br /><hr class=\"line\" width=\"98%\" noShade SIZE=\"1\" /><br />";

    }
echo "</td></tr></table>";
//closetable();

developer();

    include("footer.php");
}


/************************************************************************/
switch($action) {


    case "viewayat":
    viewayat($surano);
    break;

    case "search";
    search($query);
    break;


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

    case "choose":
   choose();
    break;

    default:
    index();
    break;

}


There are more things which should be mod....
 
View user's profile Send private message
whatever72







PostPosted: Wed Oct 24, 2012 8:39 am Reply with quote

Thanks for the reply,

yes im using RavenNuke.

I heard that this module contains a flaw that may allow an attacker to carry out an SQL injection attack.Thats the reason i needed this module to be rewritten.

Code:


http://[target]/modules.php?name=Quran&action=viewayat&surano=-0000/**/union+select/**/0,aid,0,0,0/**/from/**/nuke_authors/*where%20admin1

http://[target]/modules.php?name=Quran&action=viewayat&surano=-0000/**/union+select/**/0,pwd,0,0,0/**/from/**/nuke_authors/*where%20admin1
 
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Wed Oct 24, 2012 9:12 am Reply with quote

You must protect the sql-querys. If the variable $surano an integer/numeric value, then you can check it with is_numeric or is the variable a textstring, then you can escape it before you are use it in the query. Which version of RavenNuke you are using... 2.5 or a lower version?
 
View user's profile Send private message
whatever72







PostPosted: Wed Oct 24, 2012 9:39 am Reply with quote

RN2.5
 
neralex







PostPosted: Wed Oct 24, 2012 10:01 am Reply with quote

Ok, can you export the sql-table 'quran' to check the fields? If you have separate admin files, then it must also be changed.
 
whatever72







PostPosted: Wed Oct 24, 2012 11:37 am Reply with quote

opps sorry


Last edited by whatever72 on Wed Oct 24, 2012 12:04 pm; edited 1 time in total 
whatever72







PostPosted: Wed Oct 24, 2012 11:50 am Reply with quote

No admin files just this index.php file.
you can download the tables from here [ Only registered users can see links on this board! Get registered or login! ]
 
neralex







PostPosted: Thu Oct 25, 2012 3:10 am Reply with quote

Ok, I have the module rewritten. Now it runs only with RN25 and it seems that your posted injections doesn't work anymore. The code is complete xHTML validated and i have added a own css-file for the module. I have put all css-styles in this file. You can found the css-file in the style-folder of the module. The module styles are working also theme-based. So you can make a copy of the css-file into your styles-folder of your theme(s) dan you can create for every used heme a own css-file for the module.

You have in the index.php of the module in line 26 and 27 two variables to determine two options. The $brbetweentables option you found also in the index.php of the admin folder.

Code:
$brbetweentables = false; // set to false to have no br-tags between CloseTable() and OpenTable()

$show_audiofiles = false; // set to false to hide the audiofiles in the index


I have added some admin-functions to manage (edit, delete, post new) your entries of both database tables. In the new admin sections is a little update-script for your existent database tables. The update-script renames both db-tables to nuke_quran and nuke_quarn_ar. Its better to use with the prefix.

But i had some trouble with the entries of arabic db-table (quarn_ar), because the specialchars aren't shown correctly. I hope in your installed quarn_ar table is all fine. If not, then you can edit now every entry.

Be careful, if you are delete entries. To get correct results in the module, you must have in both db-tables for every id the same values of 'surano' and 'ayatno'. But i think you know that. Smile

Before you try the new module, please make a backup of your existent data!

Download: [ Only registered users can see links on this board! Get registered or login! ]

1. download and extract the package
2. upload the files of the html folder
3. activate the module and click on "Quran" button on the admin.php

The first run after you click the "Quran" button renames the tables.
If is it all fine, then you get message and can start with new version of the module.

If you get errors, then let me know what is wrong.

If you like the new version, then make Raven happy: [ Only registered users can see links on this board! Get registered or login! ]

Wink


Last edited by neralex on Sat Oct 27, 2012 2:45 pm; edited 1 time in total 
whatever72







PostPosted: Fri Oct 26, 2012 5:19 am Reply with quote

RavensScripts

Thanks a lot its just perfect ,works fine without any error.
But can you please adjust 2 things.
first cant hide the right blocks.
second can you add the
Sura:no Ayaat:no
for the search result too.

Thanks again.
 
neralex







PostPosted: Fri Oct 26, 2012 6:29 am Reply with quote

I have updated the index.php and the lang-english.php inside the package

Download: [ Only registered users can see links on this board! Get registered or login! ]

To hide the right blocks, you can use the define rule on the top of the index.php

Code:
//define('INDEX_FILE', true); // comment out to hide the right blocks 


I have added your wish in the search results and also some language constants. Your PM I have sent to Raven.


Last edited by neralex on Sat Oct 27, 2012 2:45 pm; edited 1 time in total 
whatever72







PostPosted: Sat Oct 27, 2012 12:48 pm Reply with quote

Thankyou once again.
 
neralex







PostPosted: Sat Oct 27, 2012 2:46 pm Reply with quote

...after a little bug-hunt, DL files updated Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> For Hire

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©