-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
87 lines (73 loc) · 2.3 KB
/
login.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
<?php session_start(); ?>
<?php
include_once "connection/conn.php";
?>
<!DOCTYPE html>
<html>
<title>admin</title>
<link rel="stylesheet" type="text/css" href="common/css/login.css">
<style type="text/css">
.bs-example {
margin:10px;
}
body {
background: url("common/images/");
background-position: center 0;
backface-visibility: visible;
background-color: #ffff!important;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div class="container" style="margin-top:40px; color: red;">
</div>
<div style="width: 200px;height: 50px;margin:0 auto;color: red;">
<?php
if ($_SERVER["REQUEST_METHOD"]=="POST") {
$email=$_POST["email"];
$pass=$_POST["pass"];
if (empty($email) || empty($pass)) {
echo "Field must not be empty";
}else{
$pass=md5($pass);
$sql="SELECT * FROM admin where email='$email' and password='$pass'";
$query=mysqli_query($connection,$sql);
if ($query !=false) {
$row=mysqli_num_rows($query);
if ($row==1) {
$value=mysqli_fetch_array($query,MYSQLI_ASSOC);
$_SESSION["login"]=true;
$_SESSION["admin_id"]=$value["admin_id"];
$_SESSION["email"]=$value["email"];
header("location:admin.php");
}else{
echo "The password did not match";
}
}
}
}
?>
</div>
<section class="loginpage clear">
<form action="" method="post">
<h2>Login Page</h2>
<div>
<label>E-mail</label>
<input type="email" name="email" placeholder="E-mail"/>
</div>
<div>
<label>Password</label>
<input type="password" name="pass" placeholder="Password"/>
</div>
<div>
<input type="submit" name="submit" value="Login" />
</div>
<div class="abcd">
<p class="ab">Not Registred?
<a class="dd" href="registrar.php" value="Login">Signup</a></p>
</div>
</form>
</section>
</body>
</html>