-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresult.php
More file actions
42 lines (33 loc) · 949 Bytes
/
result.php
File metadata and controls
42 lines (33 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once("modules/link_db.php");
require_once("include/func.php");
require_once("include/config.php");
session_start();
if(!check_login()) {
header("Location: info.php?class=danger&info=NOT_LOG");
exit;
}
$PAGE_NAME = "result.php";
$submit_ans = isset($_POST["ans"]) ? $_POST["ans"] : NULL;
$prob_id = isset($_POST["pid"]) ? $_POST["pid"] : NULL;
if(!is_numeric($prob_id)) {
header("Location: info.php?class=danger&info=PID_NOT_NUM");
exit;
}
$ld = new link_db();
$ld -> init();
$suc = $ld -> fetch_prob($prob_id, $owner, $title, $desc, $choice, $options, $ans, $det_ans);
if(!$suc) {
$ld -> close();
header("Location: info.php?class=danger&info=PROB_NOT_FOUND");
exit;
}
if($choice == true) {
$option = NULL;
sep($options, $option, false);
}
$result = ($ans == $submit_ans);
$ld -> update_prob_status($prob_id, $_SESSION["login"], $result);
$ld -> close();
require_once("views/result.php");
?>