-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin.php
98 lines (91 loc) · 3.13 KB
/
admin.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
<?php
include_once 'database.php';
session_start();
if(isset($_SESSION["email"]))
{
session_destroy();
}
$ref=@$_GET['q'];
if(isset($_POST['submit']))
{
$email = $_POST['email'];
$password = $_POST['password'];
$email = stripslashes($email);
$email = addslashes($email);
$password = stripslashes($password);
$password = addslashes($password);
$email = mysqli_real_escape_string($con,$email);
$password = mysqli_real_escape_string($con,$password);
$result = mysqli_query($con,"SELECT email FROM admin WHERE email = '$email' and password = '$password'") or die('Error');
$count=mysqli_num_rows($result);
if($count==1)
{
session_start();
if(isset($_SESSION['email']))
{
session_unset();
}
$_SESSION["name"] = 'Admin';
$_SESSION["key"] ='admin';
$_SESSION["email"] = $email;
header("location:dashboard.php?q=0");
}
else
{
echo "<center><h3><script>alert('Sorry.. Wrong Username (or) Password');</script></h3></center>";
header("refresh:0;url=admin.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Admin Login | Online Quiz System</title>
<link rel="stylesheet" href="scripts/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="scripts/ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="css/form.css">
<style type="text/css">
body{
width: 100%;
background: url(image/book.png) ;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
</head>
<body>
<section class="login first grey">
<div class="container">
<div class="box-wrapper">
<div class="box box-border">
<div class="box-body">
<center> <h5 style="font-family: Noto Sans;">Login to </h5><h4 style="font-family: Noto Sans;">Admin Page</h4></center><br>
<form method="post" action="admin.php" enctype="multipart/form-data">
<div class="form-group">
<label>Enter Your Email Id:</label>
<input type="email" name="email" class="form-control">
</div>
<div class="form-group">
<label class="fw">Enter Your Password:
<a href="javascript:void(0)" class="pull-right">Forgot Password?</a>
</label>
<input type="password" name="password" class="form-control">
</div>
<div class="form-group text-right">
<button class="btn btn-primary btn-block" name="submit">Login</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<script src="js/jquery.js"></script>
<script src="scripts/bootstrap/bootstrap.min.js"></script>
</body>
</html>