-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (37 loc) · 1.7 KB
/
index.php
File metadata and controls
53 lines (37 loc) · 1.7 KB
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
<?php
require ("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$myid = mysqli_real_escape_string($conn, $_POST['examno']);
$mypin = mysqli_real_escape_string($conn, $_POST['pin']);
$sql = "Select id FROM user WHERE pin = '$mypin'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$active = $row['active'];
$count = mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1) {
$_SESSION['login_user'] = $myid;
header("location: result.php");
}else {
$error = "Your Login Name or Password is invalid";
}
}
?>
<?php include("header.php"); ?>
<div align = "center">
<div style = "width:300px; border: solid 1px #333333; " align = "left">
<div style = "background-color:#333333; color:#FFFFFF; padding:10px;"><b>Enter Your Details</b></div>
<div style = "margin:30px">
<form action = "" method = "post">
<label>Examno :</label><input type = "text" name = "examno" class = "box"/><br /><br />
<label>Pin :</label><input type = "text" name = "pin" class = "box" /><br/><br />
<input type = "submit" value = " Submit " class="button"/><br />
</form>
<div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div>
</div>
</div>
</div>
</body>
<?php include("footer.php"); ?>