-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmiddle.php
92 lines (77 loc) · 1.97 KB
/
middle.php
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Select Exam</title>
<link rel="stylesheet"
type="text/css" href="./styles/middle.css?">
</head>
<body>
<?php
session_start();
include 'db.php';
$exit = 0;
if (!isset($_POST['seat']))
{
echo 'direct access not allowed';
exit();
}
if ($_POST['mothername'] == '' && $_POST['seat'] == '')
{
$msg = "Please enter the SEAT NO. AND MOTHER's NAME.";
$exit = 1;
}
elseif ($_POST['mothername'] == '')
{
$msg = "Please enter the MOTHER's NAME.";
$exit = 1;
}
elseif ($_POST['seat'] == '')
{
$msg = "Please enter the SEAT NO.";
$exit = 1;
}
if($exit == 1)
{
echo $msg;
exit();
}
$seat_no = strtolower($_POST["seat"]);
$mother_name = strtolower($_POST["mothername"]);
$seat_no = $cleanStr = preg_replace('/[^A-Za-z0-9 ]/', '', $seat_no);
$mother_name = $cleanStr = preg_replace('/[^A-Za-z0-9 ]/', '', $mother_name);
$sql = "SELECT * FROM marks WHERE seat_no = '$seat_no' AND mother_name = '$mother_name' ORDER BY id DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
//get subject info
while($row = $result->fetch_assoc())
{
$temp = $row["exam_id"];
$sql = "SELECT * FROM exam_details WHERE id = '$temp' ORDER BY id DESC LIMIT 1";
$result1 = $conn->query($sql);
if ($result->num_rows == 0)
{
die("ERROR, exam not found");
}
$_SESSION["seatno"] = $seat_no;
$_SESSION["mothername"] = $mother_name;
while($row1 = $result1->fetch_assoc())
{
?>
<a href="./result.php?eid=<?php echo $temp?>" style="--clr:#1e9dff"><span> <?php echo $row1["EXAM_NAME"] ?> </span></a>
<?php
}
}
} else
{
$_SESSION["error"] = "Invalid Information";
$_SESSION["seatno"] = $seat_no;
$_SESSION["mothername"] = $mother_name;
header("location: index.php");
}
?>
</body>
</html>