-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.php
107 lines (85 loc) · 3.12 KB
/
index.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
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body>
<div class="bgimg"><font color="white">
<div>
<?php include('topbar.php');
echo '<script>alert("placeholder values are correct for username and password!!")</script>';?>
</div>
<br><br>
<hr>
<marquee id="non-printable" bgcolor="#CCCEDA" style="opacity: 0.4; color:red"; width="100%" direction="left" height="50px"><br>
!! To stop the spread of corona virus wear MASK !!
</marquee>
<hr>
<header>
<h1><center>Students Results Management System</center></h1>
</header>
<table align="center" cellspacing="15">
<form method="POST" action="index.php">
<tr>
<td><h3>♛For admin♛</h3></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td><h3>♟For students♟</h3></td></td>
</tr>
<tr rowspan=4>
<td>Username</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td style="font-size: 20px"><a href="studentdash.php" style="color:white">Click here</a> to check the results.</td>
</tr>
<tr>
<td><input class="input-box" type="text" id="UserName" name="UserName" placeholder="admin"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td>Password</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td><input class="input-box" type="Password" id="admin-pwd" name="admin-pwd" placeholder="1234"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td><center><input class="button" type="submit" value="Submit" name="Submit" style="background-color: none; opacity: 0.5"></center></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
</table><br><br><br>
<p class="text-center"><small>Copyright © PANCHNAMA</small></p>
<br><br><br><br><br><br><br><br><br>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['Submit'])) {
// echo"hello hello mic testing 123 chk chk";
$con=mysqli_connect('localhost','root','','rms');
if (!$con) {
die("Connection failed");
}
else{
$uname = $_POST['UserName'];
$pass = $_POST['admin-pwd'];//do md5 at last
// here user name and password are called from data base
$sql = "SELECT username, password FROM admin ";
$result = mysqli_query($con,$sql);
$num_row = mysqli_num_rows($result);
if($num_row > 0){
while($row = mysqli_fetch_array($result)){
//this is to check if either of the fields are vacaent
if (empty($uname) || empty($pass)) {
echo '<script>alert("please fill all the fields")</script>';
}
//this part is to chk if the pass and user name are correct
else if($uname == $row["username"] && $pass == $row["password"]){
$_SESSION['uname']=$uname;
header('location:adminpanel.php');
// echo "<script> window.location.assign('adminpanel.php'); </script>";
}
// this part is to accept
else
echo '<script>alert("Wrong Password or UserName")</script>';
}
}
}
}
?>