-
Notifications
You must be signed in to change notification settings - Fork 0
/
accessctrl.php
322 lines (285 loc) · 9.25 KB
/
accessctrl.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php //access control script
include_once("/doc_cabinet_connect.php");
include_once("/errorPrompt.php");
session_start();
//setting time zone.
date_default_timezone_set('Africa/Lagos');
$rez = "";
$row = 0;
$field = "";
//mysqli equivalent of mysql_result()
function mysqli_result($rez, $row, $field){
$rez->data_seek($row);
$dataRow = $rez->fetch_assoc();
return $dataRow[$field];
}
function mysqli_result2($rez, $row, $field = 0){
$rez->data_seek($row);
$dataRow = $rez->fetch_array();
return $dataRow[$field];
}
//$uEmail = isset($_POST['uEmail']) ? $_POST['uEmail'] : $_SESSION['uEmail'];
if(isset($_POST['uEmail'])){
$uEmail = $_POST['uEmail'];
}elseif(isset($_SESSION['uEmail'])){
$uEmail = $_SESSION['uEmail'];
}
//$uPassword = isset($_POST['uPassword']) ? $_POST['uPassword'] : $_SESSION['uPassword'];
if(isset($_POST['uPassword'])){
$uPassword = $_POST['uPassword'];
}elseif(isset($_SESSION['uPassword'])){
$uPassword = $_SESSION['uPassword'];
}
$errorMsg3 ="";
if(!isset($uEmail)) {
$errorMsg3 = "<li><b>Please Sign In</b>: You do need to sign in to continue.</li>";
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign In</title>
<link rel = "stylesheet" type ="text/css" href = "css/bootstrap.min.css">
<link rel = "stylesheet" type = "text/css" href = "css/codedoc.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<script src="js/jquery-1.8.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src = "js/docindex.js"></script>
<!--HEADER SECTION-->
<div class="headr">
<div class="container">
<div class="span12">
<div class="row-fluid">
<!--SITE LOGO-->
<div class="span8"><img src = "img/pyrusclogo v4.gif"></div>
<!--LOGIN FORM ON HEADER-->
<div class="span4">
<form class="form-inline">
<div id ="headr-login2">
<label>
<p>Don't have an account yet?
</label>
<button type="submit" class="btn">Sign up</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!--FLAG SECTION-->
<?php
if(!empty($errorMsg3)){
echo('<div class = "redflag"><div class ="container"><div class = "row-fluid"><div class = "errFlagMgr">'.$errorMsg3.'</div></div></div></div>');
}
?>
<!--CONTENT SECTION-->
<div class = "container">
<div class = "span12">
<div class = "row-fluid">
<div class = "span2"></div>
<div class = "span8" style = "margin-top:2.5em;">
<div id = "signin-form1">
<form class="form-horizontal" method="post" action = "<?php echo $_SERVER['PHP_SELF'];?>">
<table>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputEmail">Email</label>
<div class="controls">
<input type="text" id="inputEmail" placeholder="Email" name = "uEmail">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">
<input type="password" id="inputPassword" placeholder="Password" name = "uPassword">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button type="submit" class="btn" name = "SigninSubmit" value = "Sign in">Sign in</button>
</div>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
<div class = "span2"></div>
</div>
</div>
</div>
<!--FOOTER-->
<div class="footr" style = "margin-top:2.2em;">
<div class="container">
<div class ="span12">
<div class = "footrLinks">
<div class="copyright">© <?php echo date("Y");?>
<a href ="">Kaelahi Technologies</a>
<a href ="">About Us</a>
<a href ="">Contact</a>
<a href ="">Career</a>
<a href ="">FAQ</a>
<a href ="">Privacy Statement</a>
<a href ="">Terms and Conditions</a>
<a href ="">Blog</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
exit;
}
$_SESSION['login_status'] = "1";
$_SESSION['uEmail'] = "$uEmail";
$_SESSION['uPassword'] = "$uPassword";
//Crosscheck login details
$dblink = dbconnect('doc_cabinet');
$query = sprintf("SELECT * FROM users_details WHERE user_Email ='%s' AND user_PW ='%s'",
mysqli_real_escape_string($dblink, $uEmail),
md5(mysqli_real_escape_string($dblink, $uPassword)));
$result = mysqli_query($dblink, $query);
if (!$result) {
$message = 'Invalid query: ' . mysqli_error($dblink) . "\n";
$message .= 'Whole query: ' . $query;
die($message);
errorCall($message);
}
if (mysqli_num_rows($result) == 0) {
$_SESSION['login_status'] = "";
unset($_SESSION['uEmail']);
unset($_SESSION['uPassword']);
$errorMsg3 = "<li><b>Access Denied</b>: Looks like your <b>Email Address and/or Password may be incorrect</b>.</li>";
$errorMsg3 .= "<li>If you've not Signed up on Pyruscape, you do need to do that <a href =\"signup.php\">here</a>.</li>";
?>
<!DOCTYPE html>
<html>
<head>
<title>Access Denied</title>
<link rel = "stylesheet" type ="text/css" href = "css/bootstrap.min.css">
<link rel = "stylesheet" type = "text/css" href = "css/codedoc.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<script src="js/jquery-1.8.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src = "js/docindex.js"></script>
<!--HEADER SECTION-->
<div class="headr">
<div class="container">
<div class="span12">
<div class="row-fluid">
<!--SITE LOGO-->
<div class="span8"><img src = "img/pyrusclogo v4.gif"></div>
<!--LOGIN FORM ON HEADER-->
<div class="span4">
<form class="form-inline">
<div id ="headr-login2">
<label>
<p>Don't have an account yet?
</label>
<button type="submit" class="btn">Sign up</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!--FLAG SECTION-->
<?php
if(!empty($errorMsg3)){
echo('<div class = "redflag"><div class ="container"><div class = "row-fluid"><div class = "errFlagMgr">'.$errorMsg3.'</div></div></div></div>');
}
?>
<!--CONTENT SECTION-->
<div class = "container">
<div class = "span12">
<div class = "row-fluid">
<div class = "span2"></div>
<div class = "span8">
<div id = "signin-form">
<form class="form-horizontal" method="post" action = "<?=$_SERVER['PHP_SELF']?>">
<table>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputEmail">Email</label>
<div class="controls">
<input type="text" id="inputEmail" placeholder="Email" name = "uEmail">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">
<input type="password" id="inputPassword" placeholder="Password" name = "uPassword">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button type="submit" class="btn" name = "SigninSubmit" value = "Sign in">Sign in</button>
</div>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
<div class = "span2"></div>
</div>
</div>
</div>
<!--FOOTER-->
<div class="footr">
<div class="container">
<div class ="span12">
<div class = "footrLinks">
<div class="copyright">© <?php echo date("Y");?>
<a href ="">Kaelahi Technologies</a>
<a href ="">About Us</a>
<a href ="">Contact</a>
<a href ="">Career</a>
<a href ="">FAQ</a>
<a href ="">Privacy Statement</a>
<a href ="">Terms and Conditions</a>
<a href ="">Blog</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
exit;
}
?>