Jump to content


Random Quraic Verse (Unreal Portal Block)


  • This topic is locked This topic is locked
No replies to this topic

#1 cricket

    Administrator

  • Root Admin[Root Admin]
  • PipPipPip
  • 301 posts

Posted 16 November 2005 - 07:41 AM

<?php

# Clear the content from other modules
  $content = "";

# The script starts here

  // function for random number
  function make_seed() {
	list($usec, $sec) = explode(' ', microtime());
	return (float) $sec + ((float) $usec * 100000);
  }

  // collect global variables
  if ($_SERVER) foreach ($_SERVER as $k => $v) $$k = &$_SERVER[$k];
  if ($_GET) foreach ($_GET as $k => $v) $$k = &$_GET[$k];
  if ($_POST) foreach ($_POST as $k => $v) $$k = &$_POST[$k];

  if ($qv != "") {$qv = explode (":", $qv);} // qv := 'Quick Verse/Ayah'
  
  // randomize vid - verse id
  if ($vid == "") { 
	srand(make_seed());
	$vid = 1 + rand()%6236;
  }

  $pid = $vid-1; if ($pid<1) $pid=1;
  $nid = $vid+1; if ($nid>6236) $nid=6236;

  // main language: arabic language
  if ($qv[0] != "") 
	$this->ipsclass->DB->query("
	SELECT surano_ar, ayatno_ar, ayat_ar from quran_ar WHERE surano_ar=".$qv[0]." and ayatno_ar=".$qv[1]);
  else $this->ipsclass->DB->query("
	SELECT surano_ar, ayatno_ar, ayat_ar FROM quran_ar WHERE id=".$vid);
  $result = $this->ipsclass->DB->fetch_row();

  $surano_ar = $result['surano_ar'];
  $ayatno_ar = $result['ayatno_ar'];
  $ayat_ar = $result['ayat_ar'];

  // second language : just replace the existing variables with the right ones according to your database table.
  // In this file, I use table 'quran' for english translation.
  $this->ipsclass->DB->query("
	SELECT ayat, sura, surano, ayatno from quran WHERE surano=".$surano_ar." and ayatno=".$ayatno_ar);
  $result = $this->ipsclass->DB->fetch_row();
  $ayat = $result['ayat'];
  $sura = $result['sura'];
  $surano = $result['surano'];
  $ayatno = $result['ayatno'];
  $ayatno2 = $ayatno - 1;
  
  // displaying the verse
	$content ="<strong> Displaying: </strong>Srh. <b>$sura ($surano)</b> Ayat <b>$ayatno</b></td></tr>";
	$content .="<tr><td class='row1' valign='middle' width'90%' align='right'><font style='font-family:Simplified Arabic;font-size:18px' color=black> $ayat_ar</font></td><td width='10%' class='row1' align='right' valign='middle'> <a href='http://quran.al-islam.com/Recite/Recite_g2.asp?s=$surano&f=$ayatno&&t=$ayatno2&Reciter=1'><img src='style_images/<#IMG_DIR#>/audio.gif' border='0' alt='Listen to this ayat (verse)' style='float: right'></a></td></tr>";
	$content .=" <tr><td width='100%' class='row1' align='justify' valign='top' colspan='2'>$surano.$ayat";
	$content .= "<br><a href=index.php?act=quran&op=display&surano=$surano&ayatno=$ayatno>";
	$content .= "<br><center>[ Srh. $sura : $ayatno ]</center>";

echo $content;

?>

Posted Image





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users