forked from codentricks/adminplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
120 lines (84 loc) · 2.96 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
ob_start();
session_start();
require('settings/core.php');
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
<title>Admin Plus</title>
<link rel="stylesheet" href="css/style.css" />
<script src="bower_components/modernizr/modernizr.js"></script>
</head>
<body>
<div class="row">
<div class="large-6 large-centered columns">
<section class="text-center">
<div class="rounded">
<h1>Admin <i class="fa fa-plus"></i></h1>
</div>
<?php
$user=(isset($_POST['user']))?$sp->real_escape_string(trim($_POST['user'])):'';
$pass=(isset($_POST['pass']))?$sp->real_escape_string(trim($_POST['pass'])):'';
$pass=$sanjay->hashPass($pass);
if(isset($_POST['submit'])){
$query="select * from sanjay_plus where u_user='$user'";
$query=$sp->query($query) or die($sp->error);
$count=$query->num_rows;
$row = $query->fetch_assoc() ;
if($count<1){
echo '<div data-alert class="alert-box warning radius">';
echo '<b>User</b> not exist';
echo '<a href="#" class="close">×</a>';
echo '</div>';
}
else{
if($row['u_access']=='0'){
echo '<div data-alert class="alert-box alert radius">';
echo '<b>User</b> access is blocked by Admin...';
echo '<a href="#" class="close">×</a>';
echo '</div>';
}
if($row['u_access']=='1'){
if($row['u_pass']==$pass){
$_SESSION['user']=$user;
$_SESSION['openpluslogged']='1';
header("Location:dashboard.php");
}else{
echo '<div data-alert class="alert-box warning radius">';
echo '<b>Error !</b> Wrong Password...';
echo '<a href="#" class="close">×</a>';
echo '</div>';
}
}
}
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<div class="row">
<div class="large-12 columns">
<input type="text" name="user" placeholder="Username" required />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="password" name="pass" placeholder="Password" required />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="submit" name="submit" value="Login" class="button expand radius">
</div>
</div>
</form>
</section>
</div>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/foundation/js/foundation.min.js"></script>
<script src="js/app.js"></script>
</body>
</html>