get_Question_Categories(); $type = filter_input(INPUT_POST, 'type', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => "/Unix|Windows/", 'flag' => FILTER_NULL_ON_FAILURE]]); $cat_id = (int) filter_input(INPUT_POST, 'cat', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); if (!$cat_id) { $cat_id = (int) filter_input(INPUT_GET, 'cat', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); } $action = filter_input(INPUT_POST, 'action', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE); if ($type) { $db->set_Questions($type, $cat_id); } if ($action) { $questions = $db->get_Questions($cat_id, $type); foreach ($questions as $key => $ques) { $ques->answer = isset($_REQUEST[$ques->key]); $db->set_QA($cat, $ques); } header("Location: /ste"); } $title_prefix = "Category Interview"; include_once 'header.inc'; ?>
"; } else { die("Lost access to the category"); } ?> Type:
get_Questions($cat_id, $type); if (is_array($questions) && count($questions)) { ?>
$ques) { $class = ($odd ? 'odd_row' : 'even_row'); $ques->question = preg_replace("/\t/", " ", $ques->question); print ""; $odd = !$odd; } ?>
Question Answer
" . nl2br($ques->question) . "answer ? " checked='true'" : '') . " value='1' />