<?php /** * @version showoptions.php 2009-08-07 $ * @copyright Copyright (C) icrs.com. All rights reserved. * * @author Amol Divalkar * @Modified By * @version 1.0 * @desc This is main file (showoptions) which is used to show the options for the quiz */ //Includes config file include "../includes/config.inc.php"; //Includes global class file include DIR_ADMIN_CLASSES . "/clsGlobal.php"; //Checks if session is set for admin login or not if ($_SESSION["UsErId"] == "" && $_SESSION["UnAmE"] == "") { header("Location:index.php"); } $hldGlobal = new clsGlobal($hdlDb); //print_r($_GET); echo $hldGlobal->fnFetchAnswerTemp($_GET["ques_id"]);
} } //print_r($_POST); if ($intError) { echo "Options should not be empty<br>"; } if (!$intError) { for ($i = 0; $i < $_POST["hid"]; $i++) { //$sql = "INSERT INTO temp_quiz_options(id,qid,options,isactive,dtcreated) values('','".$_POST["qid"]."','".addslashes(trim($_POST["opt"][$i]))."','1','".date("Y-m-d H:i:s")."')"; $sql = "INSERT INTO tblQuizOption(id,qid,options,isactive,dtcreated) values('','" . $_POST["qid"] . "','" . addslashes(trim($_POST["opt"][$i])) . "','1','" . date("Y-m-d H:i:s") . "')"; mysql_query($sql) or die(mysql_error()); if ($_POST["ans"] != "") { if ($_POST["ans"] == $i) { $intOption = mysql_insert_id(); } } } if ($intOption) { //$sqlUpd = "UPDATE temp_quiz_question SET option_id='".$intOption."' WHERE id=".$_POST["qid"]; $sqlUpd = "UPDATE tblQuizQuestion SET option_id='" . $intOption . "' WHERE id=" . $_POST["qid"]; mysql_query($sqlUpd); } $strTab = $hldGlobal->fnFetchAnswerTemp($_POST["qid"]); //$sql = "SELECT quiz_title_id FROM temp_quiz_question WHERE id=".$_POST["qid"]; $sql = "SELECT quiz_title_id FROM tblQuizQuestion WHERE id=" . $_POST["qid"]; $rs = mysql_query($sql); $rw = mysql_fetch_array($rs); $strResposeText = "AddOption~" . $rw["quiz_title_id"]; echo $strResposeText; } exit;
<?php /** * @version correctoption.php 2009-08-13 $ * @copyright Copyright (C) icrs.com. All rights reserved. * * @author Amol Divalkar * @Modified By * @version 1.0 * @desc This is main file (correctoption) which is used to choice the correct option */ //Includes config file include "../includes/config.inc.php"; //Includes global class file include DIR_ADMIN_CLASSES . "/clsGlobal.php"; //Checks if session is set for admin login or not if ($_SESSION["UsErId"] == "" && $_SESSION["UnAmE"] == "") { header("Location:index.php"); } $hldGlobal = new clsGlobal($hdlDb); $arrOptId = explode("~", $_GET["id"]); $id = $arrOptId[0]; $qid = $arrOptId[1]; $intOption = $hldGlobal->fnCorrectOption($id, $qid); $strTab = $hldGlobal->fnFetchAnswerTemp($qid); echo $strTab; echo '<script>document.getElementById("error_option").innerHTML="Correct option updated"</script>'; exit;
<?php /** * @version removequestion.php 2009-08-06 $ * @copyright Copyright (C) icrs.com. All rights reserved. * * @author Amol Divalkar * @Modified By * @version 1.0 * @desc This is main file (removequestion) which is used to remove the question for particular quiz */ //Includes config file include "../includes/config.inc.php"; //Includes global class file include DIR_ADMIN_CLASSES . "/clsGlobal.php"; //Checks if session is set for admin login or not if ($_SESSION["UsErId"] == "" && $_SESSION["UnAmE"] == "") { header("Location:index.php"); } $hldGlobal = new clsGlobal($hdlDb); $arrIds = explode("~", $_GET["id"]); $hldGlobal->fnDeleteOptions($arrIds[0]); $strTab = $hldGlobal->fnFetchAnswerTemp($arrIds[1]); echo $strTab;