-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
159 lines (115 loc) · 4.82 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
error_reporting(0);
session_start();
include("connection.php");
$userid_st = 0;
$password_st = 0;
if(isset($_POST['logged'])==1){
$password = mysqli_real_escape_string($dbc, $_POST['password']);
$q1 = "SELECT * FROM admin WHERE id='$_POST[userid]'";
$q2 = "SELECT * FROM admin WHERE id='$_POST[userid]' AND pwd=SHA1('$password')";
if(mysqli_num_rows(mysqli_query($dbc, $q1))==1){
$userid_st = 1;
if(mysqli_num_rows(mysqli_query($dbc, $q2))==1){
$password_st = 1;
$_SESSION['username'] = $_POST['userid'];
header("Location: index1.php");
}
else{
$password_st = -1;
}
}
else{
$userid_st = -1;
$password_st = -1;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5, user-scalable=no">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link href="https://fonts.googleapis.com/css?family=Lato:100,300" rel="stylesheet">
<!-- simple captcha style -->
<link rel="stylesheet" href="captcha.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>LogIn </title>
<?php include("css.php"); ?>
<?php include("js.php"); ?>
</head>
<body style="background-color:powderblue;" center>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
</div>
</nav>
<div class="container1">
<div class="row">
<div class="col-md-3">
<legend class="form-heading" center>LogIn </legend>
<br />
<form action="" method="post" >
<div class="form-group<?php if($userid_st==1){echo " has-success has-feedback";}elseif($userid_st==-1){echo " has-error has-feedback";} ?>" style="border: 3px solid black;">
<input type="text" id="userid" name="userid" class="form-control" placeholder="UserID" required >
<?php if($userid_st==1){ ?>
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
<?php }elseif($userid_st==-1){ ?>
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
<?php } ?>
</div>
<br />
<div class="form-group<?php if($password_st==1){echo " has-success has-feedback";}elseif($password_st==-1){echo " has-error has-feedback";} ?>" style="border: 3px solid black;">
<input type="password" id="password" name="password" class="form-control" placeholder="Password" required>
<?php if($password_st==1){ ?>
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
<?php }elseif($password_st==-1){ ?>
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
<?php } ?>
</div>
<br />
<div class="form-group">
<div id="captcha">
<div class="form-group">
<label for="pwd">Captcha:</label>
<!-- input captcha -->
<div class="captcha-code">
<div class="code">
<div class="dynamic-code"></div>
</div>
<div class="captcha-reload">
<i class="ion-ios-loop-strong"></i>
</div>
</div>
<div class="captcha-input">
<input type="text" class="form-control" id="captcha-input" required autocomplete="off" placeholder="Enter captcha code ...">
<span id="errCaptcha"></span>
</div>
</div></div>
<script src="captcha.js">
</script>
</div>
<table>
<tr>
<td>
<div class="form-group">
<input type="submit" class="btn btn-primary" name="logged" value="Log In"></input>
</div>
</td>
<td >
<div class="form-group" ><right>
<a href="newadmin.php" class="btn btn-primary">new user</a>
</div>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>