Location: PHPKode > projects > Nukequiz > html/root/nq_installer/install.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	 */
/*****************************************************************/
//Language Definitions You May Want To Edit
define("_NQ_FAILED","<b><font color='#CC0000'>&nbsp;Failed</font></b>");
define("_NQ_OK","<b><font color='#00CC00'>&nbsp;Completed</font></b>");
define("_NQ_CREATIONOF","<b>&loz;&nbsp;Creation Of Table&nbsp;</b>");
define("_NQ_DATA4","<b>&loz;&nbsp;Data For&nbsp;</b>");
define("_NQ_ADMIN","Nukequiz Administration");
define("_NQ_INSTALLNOTE","If You Have Upgraded - You Can Now Upload All New Nukequiz Files<br><br>Please Remove All Old Version Files Before Proceeding!!");
//////////////////////////////////////////////////////Do Not Edit Below
$pagetitle = "&copy;&nbsp;Nukequiz Installer";
@include("header.php");
OpenTable();
echo "<center><table cellpadding='2' cellspacing='2' border='0'><tr><td align='center' colspan='2'>";
echo "<b>$pagetitle</b></td></tr><tr>";
//Admin Config Tables
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_config (config_name varchar(255) NOT NULL default '', config_value text NOT NULL, KEY id (config_name))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Table Data
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('version_number', '3.1.0')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Version Checked
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('version_new', '3.1.0')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Check Date
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('version_check', '1201962211')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Results Per Page
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('pagenum', '20')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Submit Limit For Users--Not Used Yet!!!!
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('sublimit', '10')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Results To Enter Quiz League
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('league_count', '5')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//League Results Orderby
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('league_orderby', 'Average')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//League Graphics On / Off
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('league_graphics', '1')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Number Og Uploads Allowed
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('uploads', '5')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Scoreboard Visible To Users On / Off
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('showscoreboard', '1')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Max Filesize Allowed To Upload
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('max_filesize', '50000')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Dateformat For Quiz Expiry
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('dateformat', 'd-m-Y H:i')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Turn User Help On / Off
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('user_help', '1')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Points Allocated For Quiz Completion
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('nukepoints', '5-')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Points Allocated For Quiz Completion
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('userpoints', '50')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//User Notice Rules Etc
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('notice', '<ul>\r\n<li>The quiz is only open to registered users of the site which is free</li>\r\n<li>No competition entry will be accepted after the closing date</li>\r\n<li>All competition entries will be verified by admin staff</li>\r\n<li>Competition users must have a valid pay pal account</li>\r\n<li>All prizes advertised will not be replaced nor substituted for any other prize</li>\r\n<li>Any costs incurred  for delivery of a prize shall be paid for by the winner(s) </li>\r\n<li>Winners of competitions will be notified by email & private message</li>\r\n<li>Prizes not claimed within 14 days will be used for another competition</li>\r\n<li>In the event of a tie, a tie-breaker question will be emailed to all parties</li>\r\n<li>Some competitions will be run for specific group members of the site only </li>\r\n<li>The decisions of the admin staff in all matters will be final</li>\r\n<li>For further details and information, please read our rules section</li>\r\n</ul>')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//User Questions Submitted Allowed On / Off -REMOVED FOR NEXT VERSION ADDED L8R
//$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('user_question', '0')");
//if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
//else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Scroller For Blocks On / Off
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('scroll', '1')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//CutOff Limit For Usernames Before ...
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('cutoff', '10')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Block Scroller Direction
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('scrdir', 'Up')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Scroller Block Height Limit
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('scrollheight', '280')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Number Of Results To Display In Blocks Only
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('blocklist', '10')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Date Quiz League Updated
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('league_update', '26-01-2008')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Name Of Main Questions Image Directorys
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('images_directory', '')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Name Of Main Backup Directory
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('backup_directory', '')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Templates Used For Messages & Emails
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('templates', 'Designed')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Admin Alternative Email Addy
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('reply_email', 'hide@address.com')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Install Check After Settings Applied To Directorys
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('install', '0')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Max image size for display full size
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('maximagesize', '300')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Max thumbnail size
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_config VALUES ('maxthumbs', '100')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_config</td><td>"._NQ_OK."</td></tr><tr>"; }
//Quiz League Table
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_league (nqlid int(3) NOT NULL  auto_increment, username varchar(255) NOT NULL default '', email varchar(255) NOT NULL default '', count int(4) NOT NULL default '0', score int(6) NOT NULL default '0', average int(4) NOT NULL default '0', total int(6) NOT NULL default '0', totalques int(6) NOT NULL default '0', perc decimal(4,2) NOT NULL default '0.00', updated int(1) NOT NULL default '0', PRIMARY KEY (nqlid))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_league</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_league</td><td>"._NQ_OK."</td></tr><tr>"; }
//Enter Default Test Entry For League To Show Format
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_league VALUES (NULL, 'yourname', 'hide@address.com', '5', '25', '5', '36', '36', '69.44', '1')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_league</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_league</td><td>"._NQ_OK."</td></tr><tr>"; }
//Quiz Questions Table
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_questions (quesid int(11) NOT NULL auto_increment, qid int(10) NOT NULL default '0', ismcq int(1) NOT NULL default '0', ismultiple int(1) NOT NULL default '0', isoe int(1) NOT NULL default '0', question text NOT NULL, sol1 text NOT NULL, sol2 text NOT NULL, sol3 text NOT NULL, sol4 text NOT NULL, answer text NOT NULL, points int(5) NOT NULL default '0', qexplain text NOT NULL, file varchar(255) NOT NULL default '', hit_count int(5) NOT NULL default '0', PRIMARY KEY (quesid))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_questions</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_questions</td><td>"._NQ_OK."</td></tr><tr>"; }
//Quiz Titles Table
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_quiz (qid int(6) NOT NULL auto_increment, sid int(6) NOT NULL default '0', active tinyint(1) NOT NULL default '0', iscq int(1) NOT NULL default '0', prize_desc varchar(255) NOT NULL default '', sponsor varchar(255) NOT NULL default '', dir varchar(100) NOT NULL default '', title varchar(255) NOT NULL default '', emailadmin tinyint(1) NOT NULL default '0', random int(2) NOT NULL default '0', emailuser tinyint(1) NOT NULL default '0', limit_attempts tinyint(1) NOT NULL default '0', view_answers tinyint(1) NOT NULL default '0', expire int(12) NOT NULL default '0', hit_count int(11) NOT NULL default '0', maxqnum int(4) NOT NULL default '0', points_total int(6) NOT NULL default '0', rate int(12) NOT NULL, votes int(12) NOT NULL, admin_email varchar(255) NOT NULL default '', KEY qid (qid))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_quiz</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_quiz</td><td>"._NQ_OK."</td></tr><tr>"; }
//Quiz Scoreboard Table	
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_scoreboard (sbid int(8) NOT NULL auto_increment, ip varchar(20) NULL default '', starttime int(12) NOT NULL default '0', endtime int(12) NOT NULL default '0', username varchar(255) NULL default '', email varchar(255) NULL default '', qid int(11) NOT NULL default '0', score int(6) NOT NULL default '0', perc decimal(4,2) NOT NULL default '0.00', qcorrect text NOT NULL, qwrong text NOT NULL, ttime varchar(20) NOT NULL default '', date int(14) NOT NULL default '0', KEY qid (qid), PRIMARY KEY (sbid))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_scoreboard</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_scoreboard</td><td>"._NQ_OK."</td></tr><tr>"; }
//Quiz Category (Sections) Tables
$result = $db->sql_query("CREATE TABLE ".$prefix."_nquiz_sections (sid int(6) NOT NULL auto_increment, secname varchar(50) NOT NULL default '', secdesc varchar(255) default NULL, secimage varchar(25) default NULL, PRIMARY KEY (sid))");
if (!$result) { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_sections</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_CREATIONOF."".$prefix."_nquiz_sections</td><td>"._NQ_OK."</td></tr><tr>"; }
//Create Standard Category
$result = $db->sql_query("INSERT INTO ".$prefix."_nquiz_sections VALUES (1, 'Just For Fun', 'Questions Just For Fun!', 'just_for_fun.png')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_sections</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_nquiz_sections</td><td>"._NQ_OK."</td></tr><tr>"; }
//Insert into groups info for rate Nukequiz
$result = $db->sql_query("INSERT INTO ".$prefix."_groups_info VALUES (22, 'Rating A Quiz With Nukequiz')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_groups_info</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_groups_info</td><td>"._NQ_OK."</td></tr><tr>"; }
//Insert into groups points for rate Nukequiz
$result = $db->sql_query("INSERT INTO ".$prefix."_groups_points VALUES (22, '15')");
if (!$result) { echo "<td>"._NQ_DATA4."".$prefix."_groups_points</td><td>"._NQ_FAILED."</td></tr><tr>"; } 
else { echo "<td>"._NQ_DATA4."".$prefix."_groups_points</td><td>"._NQ_OK."</td></tr><tr>"; }
echo "<td colspan='2' align='center'><a href='admin.php?op=nukequiz'>"._NQ_ADMIN."</a></td></tr><tr>";
echo "<td colspan='2' align='center'>"._NQ_INSTALLNOTE."</td></tr><tr>";
echo "<td colspan='2' align='center'>"._GOBACK."";
echo "</td></tr></table></center>";
CloseTable();
@include("footer.php");
?>
Return current item: Nukequiz