Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/admin/NQAImportRandomQuestions.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	 */
/*****************************************************************/
$imagesdir = $nq_config['images_directory'];
$lastqid = intval($qid);
$last_nquiz = $db->sql_query("SELECT dir, maxqnum FROM ".$prefix."_nquiz_quiz WHERE qid='$lastqid'");
list($newdir, $maxq) = $db->sql_fetchrow($last_nquiz);
$result = $db->sql_query("SELECT * FROM ".$prefix."_nquiz_temp LIMIT 0,$maxq");
while(list($quesid, $xqid, $last, $ismcq, $ismultiple, $isoe, $question, $sol1, $sol2, $sol3, $sol4, $answer, $points, $qexplain, $quesfile, $hitcount) = $db->sql_fetchrow($result))
{
$result4 = $db->sql_query("SELECT dir FROM ".$prefix."_nquiz_quiz WHERE qid='$xqid'");
list($olddir) = $db->sql_fetchrow($result4);
$imagesource_file = "modules/$module_name/$imagesdir/$olddir/$quesfile";
if(file_exists("modules/$module_name/$imagesdir/$olddir/thumbs/th_$quesfile")){
$th_imagesource_file = "modules/$module_name/$imagesdir/$olddir/thumbs/th_$quesfile";
$th_imagedestination_file = "modules/$module_name/$imagesdir/$newdir/thumbs/th_$quesfile";
copy ($th_imagesource_file, $th_imagedestination_file);
}
$result5 = $db->sql_query("SELECT dir FROM ".$prefix."_nquiz_quiz WHERE qid='$last'");
list($newdir) = $db->sql_fetchrow($result5);
$imagedestination_file = "modules/$module_name/$imagesdir/$newdir/$quesfile";
copy ($imagesource_file, $imagedestination_file);
if (!$db->sql_query("INSERT INTO ".$prefix."_nquiz_questions VALUES (NULL, '$qid', '$ismcq', '$ismultiple', '$isoe', '$question', '$sol1', '$sol2', '$sol3', '$sol4', '$answer', '$points', '$qexplain', '$quesfile', '0')")){
die (""._NQ_DBERRORTABLE."_nquiz_questions");
}
}
$db->sql_query("DROP TABLE ".$prefix."_nquiz_temp");
Header("Location: ".$admin_file.".php?op=nqviewquizlist");
?>
Return current item: Nukequiz