<?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 */
/*****************************************************************/
$pagetitle = _NQ_ADMINQUIZIMPORTINFO;
include ("header.php");
nqmenuheader();
OpenTable();
$row = 1;
$handle = fopen ("modules/$module_name/import/$filename","r");
while ($data = fgetcsv ($handle, 1024, ",")) {
$question = "".$data[3]."";
$sol1 = "".$data[4]."";
$sol2 = "".$data[5]."";
$sol3 = "".$data[6]."";
$sol4 = "".$data[7]."";
$search = array("\"" , "'", "{COMMA}");
$replace = array("\"", "\'", ",");
$qexplain = str_replace($search, $replace, $qexplain);
$question = str_replace($search, $replace, $question);
$sol1 = str_replace($search,$replace,$sol1);
$sol2 = str_replace($search,$replace,$sol2);
$sol3 = str_replace($search,$replace,$sol3);
$sol4 = str_replace($search,$replace,$sol4);
$question = ucwords(strtolower($question));
$qexplain = ucwords(strtolower($qexplain));
$sol1 = ucwords(strtolower($sol1));
$sol2 = ucwords(strtolower($sol2));
$sol3 = ucwords(strtolower($sol3));
$sol4 = ucwords(strtolower($sol4));
$row = $db->sql_query("INSERT INTO ".$prefix."_nquiz_questions VALUES (NULL, $qid, '".$data[0]."', '".$data[1]."', '".$data[2]."', '$question', '$sol1', '$sol2', '$sol3', '$sol4', '".$data[8]."', '".$data[9]."', '".$data[10]."', '".$data[11]."', '0')");
$row++;
$count=$count+1;
}
if(!$db->sql_query("UPDATE ".$prefix."_nquiz_quiz SET maxqnum='$count' WHERE qid='$qid'")) {
die (""._NQ_DBERRORTABLE."_nquiz_quiz");
}
fclose ($handle);
unlink("modules/$module_name/import/$filename");
echo "<br><center>";
echo ""._NQ_QUESTIONSADDED.": <b>$count</b><br>";
echo "<br>"._NQ_EDITQSET.": <a href='".$admin_file.".php?&op=nqmodifyquiz&qid=$qid'>$title</a><br><br>";
echo ""._NQ_IMPORTOK."<br><br>";
echo "<b><blink>» </blink>"._NQ_SAVECHANGESNOTE."<blink> «</blink></b></center><br>";
CloseTable();
include ('footer.php');
?>