Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/admin/NQAUpdateQuizLeague.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	 */
/*****************************************************************/
if(!$db->sql_query("DELETE FROM ".$prefix."_nquiz_league")){
die (""._NQ_DBERRORTABLE."_nquiz_league");
}
$db->sql_query("OPTIMIZE TABLE ".$prefix."_nquiz_league");
$a = 0;
$league_count = intval($nq_config['league_count']);
$resulta = $db->sql_query("SELECT DISTINCT username FROM ".$prefix."_nquiz_scoreboard WHERE score >'0'");
while ($row = $db->sql_fetchrow($resulta)) {
$user = $row['username'];
$resultb = $db->sql_query("SELECT username FROM ".$prefix."_nquiz_league WHERE username='$user'");
list($username) = $db->sql_fetchrow($resultb);
if (!$username){
$adrs = $db->sql_query("SELECT email FROM ".$prefix."_nquiz_scoreboard WHERE username='$user'");
list($email) = $db->sql_fetchrow($adrs);
$counttotal = $db->sql_query("SELECT COUNT(username) as counter FROM ".$prefix."_nquiz_scoreboard WHERE username='$user'");
list($count) = $db->sql_fetchrow($counttotal);
if ($count >= $league_count){
if(!$db->sql_query("INSERT INTO ".$prefix."_nquiz_league VALUES (NULL, '$user','$email','$count','','','','','','')")){
die (""._NQ_DBERRORTABLE."_nquiz_league");
}
}
}
}
if(!$db->sql_query("UPDATE ".$prefix."_nquiz_league SET updated='0' WHERE updated='1'")){
die (""._NQ_DBERRORTABLE."_nquiz_league");
}
$a++;
$now = time();
$db->sql_query("UPDATE ".$prefix."_nquiz_config SET league_update = '$now'");
Header("Location: ".$admin_file.".php?op=nqleague");
?>
Return current item: Nukequiz