Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/index.php
<?php
/*****************************************************************/
/* Nukequiz (tm)    v 3.1.0                                		 */
/* By: Kissoftware (hide@address.com)      		     */
/* http://www.kissoftware.org.uk                           		 */
/* http://www.kissoftware.co.uk                       		     */
/* Copyright © 2003-2008 by Kissoftware         				 */
/* See Docs For Information & Credits                 			 */
/* For More information Visit Forums Or The Online Help Manual	 */
/*****************************************************************/
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = _NQ_NUKEQUIZ;
$index = 1;
define('INDEX_FILE', TRUE);
include("includes/functions_nukequiz.php");
$nq_config = nqget_configs();
switch($op) {
default:
include('header.php');
logoheader();
$userhelp = $nq_config['user_help'];
$notice = $nq_config['notice'];
$user_ques = $nq_config['user_question'];
$competitions = $nq_config['competitions'];
$pagenum = $nq_config['pagenum'];
$dateformat = $nq_config['dateformat'];
if (is_user($user) && is_admin($admin))
{
OpenTable();
$myquizimage = myquizimage("broken.png");
echo "<br><center><img src='$myquizimage' border='0'><br><br>";
echo "<b>"._NQ_USERADMINLOGGED."</b><br><blink>"._NQ_USERDETAILSUSEDONLY."</blink><br></center>";
CloseTable();
}

OpenTable();
echo "<center><br><font class='title'>"._NQ_TOPRESULTSBOARD."</font><br><br><table width='100%' border='0' cellpadding='2' cellspacing='2'><tr>";
echo "<th width='33%'>"._NQ_TOPPARTICIPANT."</th><th width='33%'>"._NQ_TOPPERCSCORER."</th><th width='33%'>"._NQ_TOPAVERAGE."</th></tr><tr>";
$result = $db->sql_query("SELECT username, count, score, average, perc from ".$prefix."_nquiz_league ORDER BY count DESC LIMIT 0,1");
list($username, $scount, $score, $average, $perc) = $db->sql_fetchrow($result);
echo "<td width='33%' class='row1' align='center'><br><b>$username</b><br><br><img src='modules/$module_name/images/trophy.gif'><br><br>"._NQ_COMPLETED."&nbsp;<b>$scount</b>&nbsp;"._NQ_QUIZZES."<br><br></td>";
$resulta = $db->sql_query("SELECT username, count, score, average, perc from ".$prefix."_nquiz_league ORDER BY perc DESC LIMIT 0,1");
list($username, $scount, $score, $average, $perc) = $db->sql_fetchrow($resulta);
echo "<td width='33%' class='row1' align='center'><br><b>$username</b><br><br><img src='modules/$module_name/images/trophy.gif'><br><br>"._NQ_SCORED."&nbsp;<b>$score</b>&nbsp;"._NQ_PTS."<br><br></td>";
$resultb = $db->sql_query("SELECT username, count, score, average, perc from ".$prefix."_nquiz_league ORDER BY average DESC LIMIT 0,1");
list($username, $scount, $score, $average, $perc) = $db->sql_fetchrow($resultb);
echo "<td width='33%' class='row1' align='center'><br><b>$username</b><br><br><img src='modules/$module_name/images/trophy.gif'><br><br>"._NQ_SCORED."&nbsp;<b>$average</b>&nbsp;"._NQ_PTS."<br><br></td>";
echo "</tr></table></center><br><br>";
CloseTable();
echo "<div id='overDiv' style=\"position:absolute; visibility:hidden; z-index:9999;\"></div>";
if (!$notice == ""){
OpenTable();
$result = $db->sql_query("SELECT notice_rules FROM ".$prefix."_nquiz_config");
list($rules) = $db->sql_fetchrow($result);
echo "<br><center><font class='title'>&raquo;&nbsp;"._NQ_NQNOTICE."&nbsp;&laquo;</font></center>";
echo "<center><br><table cellpadding='1' cellspacing='1' border='0'><tr><td>$notice";
echo "</td></tr></table></center>";
CloseTable();
}
$result = $db->sql_query("SELECT * FROM ".$prefix."_nquiz_sections");
if ($db->sql_numrows($result)== ""){
OpenTable();
echo "<center><b>"._NQ_NOCATEGORIESAVAILABLE."</b><br></center>";
CloseTable();
include("footer.php");
exit();
}
OpenTable();
echo "<br><center><table width='100%' cellpadding='2' cellspacing='2' border='0'><tr>";
echo "<th colspan='3'>"._NQ_QUIZINFORMATION."</th></tr><tr>";
while(list($sid, $secname, $secdesc, $secimage) = $db->sql_fetchrow($result)){
$resultx = $db->sql_query("SELECT COUNT(*) as help FROM ".$prefix."_nquiz_quiz WHERE sid='$sid' AND active >'0'");
list($number) = $db->sql_fetchrow($resultx);
echo "<td class='row1' width='45%'><a href='modules.php?name=$module_name&amp;op=showsection&amp;sid=$sid''>$secname</a></td>";
if ($number == ''){$number ='0';}
echo "<td class='row1' align='center'><b>$number&nbsp;</b>"._NQ_TOTALQUIZZESINCAT."</td>";
$resultc = $db->sql_query("SELECT iscq FROM ".$prefix."_nquiz_quiz WHERE sid='$sid' AND iscq >'0'");
list($iscq) = $db->sql_fetchrow($resultc);
if ($iscq =='1'){
$myquizimage = myquizimage("comp.png");
echo "<td class='row1' align='center'><img src='$myquizimage' alt='"._NQ_COMPINSECTION."' title='"._NQ_COMPINSECTION."'></td></tr>";
}
else{
$myquizimage = myquizimage("nocomp.png");
echo "<td class='row1' align='center'><img src='$myquizimage'></td></tr>";
}
}
echo "</table></center><br>";
CloseTable();
$r = $db->sql_query("SELECT qid, title, hit_count FROM ".$prefix."_nquiz_quiz ORDER BY rand() LIMIT 0,1");
list($qid, $title, $main_total) = $db->sql_fetchrow($r);
$statistics = $db->sql_query("SELECT * FROM ".$prefix."_nquiz_scoreboard WHERE qid='$qid' ORDER BY perc DESC LIMIT 0,$pagenum");
OpenTable();
echo "<br><center><font class='title'>"._NQ_TOP."&nbsp;$pagenum&nbsp;"._NQ_LISTSCORE."";
echo "&nbsp;"._NQ_CPLAYERSBY."&nbsp;:&nbsp;$main_total&nbsp;"._NQ_PLAYERS."<br>";
echo "$title</font></center><br>";
echo"<center><table width='100%' border='0' cellpadding='1' cellspacing='1'><tr>";
echo"<th width='5%'>#</th><th class='row1' width='30%'>"._NQ_NAME."</th><th class='row1' width='10%'>"._NQ_PERCENT."</th><th width='20%'>"._NQ_TTAKEN."</th><th width='35%'>"._NQ_DATETAKEN."</th></tr>";
if ($db->sql_numrows($statistics)==""){
echo "<td colspan='6'></td></tr><tr><td align='center' colspan='6'><font class='title'>"._NQ_NORESULTS."</font></td></tr>";
}
else {
$rowcount = $min+1;
while($astatistics = mysql_fetch_array($statistics)){
$setid = $db->sql_query("SELECT * FROM ".$prefix."_nquiz_quiz WHERE qid='$qid'");
$setid = mysql_fetch_array($setid);
$user = $astatistics['username'];
$name_len = $nq_config['cutoff'];
if (strlen($user) > $name_len){$user = substr($user, 0, ($name_len-2))."...";}
$score = $astatistics['score'];
$perc = $astatistics['perc'];
$date = $astatistics['date'];
$date = date($dateformat,$date );
$ttime = $astatistics['ttime'];
echo "<tr><td class='row1' align='center'>$rowcount</td><td class='row1'>$user</td><td align='center' class='row1'>$perc%</td class='row1'><td class='row1'>$ttime</td><td class='row1'>$date</td></tr>";
$rowcount++;
}
}
echo "</table><br>";
CloseTable();
scorehistory();
addtoleague();
updateleague();
include("footer.php");
break;

case "showsection":@include("modules/$module_name/public/NQPShowSection.php");break;
case "report":@include("modules/$module_name/public/NQPErrorReport.php");break;		
case "friendmail":@include("modules/$module_name/public/NQPInviteFriend.php");break;
case "sendreport":@include("modules/$module_name/public/NQPReportSend.php");break;
case "sendfriend":@include("modules/$module_name/public/NQPFriendSend.php");break;
case "statsid":@include("modules/$module_name/public/NQPStatistics.php");break;
case "id":@include("modules/$module_name/public/NQPQuestions.php");break;
case "viewimage":@include("modules/$module_name/public/NQPShowImage.php");break;
case "go":@include("modules/$module_name/public/NQPQuestions.php");break;
case "startquiz":@include("modules/$module_name/public/NQPStartQuiz.php");break;
case "gocomp":@include("modules/$module_name/public/NQPCQuestions.php");break;
case "startcompquiz":@include("modules/$module_name/public/NQPStartCompQuiz.php");break;
case "cid":@include("modules/$module_name/public/NQPCQuestions.php");break;
case "ratequizsave":@include("modules/$module_name/public/NQPRateQuizSave.php");break;
case "ratequiz":@include("modules/$module_name/public/NQPRateQuiz.php");break;
case "soundbar":@include("modules/$module_name/public/NQPShowSoundBar.php");break;
case "scoreboard":@include("modules/$module_name/public/NQPShowScoreboard.php");break;
}//HERE ENDETH THE TASK :)
?>
Return current item: Nukequiz