-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathadmin.php
More file actions
101 lines (76 loc) · 2.4 KB
/
admin.php
File metadata and controls
101 lines (76 loc) · 2.4 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php require_once'core_admin.php';
require_once 'connection.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Login</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="signup_style.css">
</head>
<body style="background-color: black;">
<?php
if(loggedin_admin())
{
$temp = $_SESSION['username_admin'];
echo <<< _END
<li>Welcome $temp </li>
<li><a href="logout.php">Logout</a>
_END;
}
?>
<div class="container">
<?php
$username = "";
if(isset( $_POST['username']) && isset($_POST['password']) )
{
$username = $_POST['username'];
$password = $_POST['password'];
$hased_password = md5($password);
}
if( !empty($username) && !empty($password) )
{
$query_login="SELECT username, password FROM admin WHERE username = '$username' AND password ='$hased_password'";
if($query_run = mysqli_query($conn,$query_login) )
{
$query_num_row = mysqli_num_rows($query_run);
if( $query_num_row == 0)
{
echo '<div class="alert1"><h5>Invalid Username or Password</h5></div>';
}
else if($query_num_row == 1)
{
$_SESSION['username_admin'] = $username;
$_SESSION['just_now'] = 1;
//echo temp;
header("location: admin_wall.php");
}
}
else
{
echo "Kindly Enter Your Login Details!";
}
}
echo <<< _END
<div class="row" style="margin:50px 15px;">
<div class="col-md-4">
<div id="logbox">
<form id="signin" method="post" action="admin.php">
<h1>Admin Sign in </h1>
<input name="username" type="text" placeholder="Admin's username?" pattern="^[\w]{3,16}$" class="input pass" required="required" value="$username" autofocus="autofocus" />
<input name="password" type="password" placeholder=" password" required="required" class="input pass"/>
<input type="submit" value="Sign me in!" class="inputButton"/>
</form>
</div>
</div>
<!--col-md-6 -->
_END;
?>
</div>
</div>
</div>
</body>
</html>