-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
81 lines (70 loc) · 2.73 KB
/
index.php
File metadata and controls
81 lines (70 loc) · 2.73 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SSRMS</title>
<link rel="stylesheet" href="css/login.css">
<link rel="stylesheet" href="./font-awesome-4.7.0/css/font-awesome.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
<body>
<div class="title">
<span>Simple Student Result Management System</span>
</div>
<div class="main">
<div class="login">
<form action="" method="post" name="login">
<fieldset>
<legend class="heading">Admin Login</legend>
<input type="text" name="userid" placeholder="Username" autocomplete="off">
<input type="password" name="password" placeholder="Password" autocomplete="off">
<input type="submit" value="Login">
</fieldset>
</form>
</div>
<div class="search">
<form action="./student.php" method="get">
<fieldset>
<legend class="heading">Student's Section</legend>
<?php
include('init.php');
$class_result=mysqli_query($conn,"SELECT `name` FROM `class`");
echo '<select name="class">';
echo '<option selected disabled>--Select Class--</option>';
while($row = mysqli_fetch_array($class_result)){
$display=$row['name'];
echo '<option value="'.$display.'">'.$display.'</option>';
}
echo'</select>'
?>
<input type="text" name="rn" placeholder="Roll Number">
<input type="submit" value="Get Result">
</fieldset>
</form>
</div>
</div>
</body>
</html>
<?php
include("init.php");
session_start();
if (isset($_POST["userid"],$_POST["password"]))
{
$username=$_POST["userid"];
$password=$_POST["password"];
$password = md5($_POST["password"]);
$sql = "SELECT userid FROM admin_login WHERE userid='$username' and password = '$password'";
$result=mysqli_query($conn,$sql);
// $row=mysqli_fetch_array($result);
$count=mysqli_num_rows($result);
if($count==1) {
$_SESSION['login_user']=$username;
header("Location: dashboard.php");
}else {
echo '<script language="javascript">';
echo 'alert("Invalid Username or Password")';
echo '</script>';
}
}
?>