Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/admin/NQADeleteQuestion.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	 */
/*****************************************************************/
$quesid = intval($quesid);
$qid = intval($qid);
$result = $db->sql_query("SELECT file FROM ".$prefix."_nquiz_questions WHERE quesid='$quesid'");
list($quesfile) = $db->sql_fetchrow($result);
$imagesdir = $nq_config['images_directory'];
unlink("modules/$module_name/$imagesdir/$quizdir/$quesfile");
unlink("modules/$module_name/$imagesdir/$quizdir/$quesfile");
unlink("modules/$module_name/$imagesdir/$quizdir/thumbs/th_$quesfile");
if(!$db->sql_query("DELETE FROM ".$prefix."_nquiz_questions WHERE (quesid='$quesid') AND (qid='$qid')")){
die (""._NQ_DBERRORTABLE."_nquiz_questions");
}
$resulta = $db->sql_query("SELECT maxqnum FROM ".$prefix."_nquiz_quiz WHERE qid='$qid'");
list($maxqnum) = $db->sql_fetchrow($resulta);
$maxqnum=$maxqnum-1;
if(!$db->sql_query("UPDATE ".$prefix."_nquiz_quiz SET maxqnum='$maxqnum' WHERE qid='$qid'")){
die (""._NQ_DBERRORTABLE."_nquiz_quiz");
}
$tpoints = $db->sql_query("SELECT sum(points) as total FROM ".$prefix."_nquiz_questions WHERE qid='$qid'");
list($points) = $db->sql_fetchrow($tpoints);
if(!$db->sql_query("UPDATE ".$prefix."_nquiz_quiz SET points_total='$points' WHERE qid='$qid'")) {
die (""._NQ_DBERRORTABLE."_nquiz_quiz");
}
$db->sql_query("OPTIMIZE TABLE ".$prefix."_nquiz_questions");
Header("Location: ".$admin_file.".php?op=nqmodifyquiz&amp;qid=$qid");
?>
Return current item: Nukequiz