/
login.php
305 lines (255 loc) · 13.6 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
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
<?
require_once("inc/global.php");
require_once(MODEL_PATH . USER_MODEL);
if(isset($_POST['login']) && !empty($_POST['login']) && $_POST['login'] == 1){
$username = $_POST['txtusername'];
$pass = strtoupper($_POST['txtpassword']);
$password = generatePassword($pass);
// SET FMS DB
$fms_db = new DBCOnfig;
$fms_db->setFleetDB();
// SET USER
$user = new Table;
$user->setSQLType($fms_db->getSQLType());
$user->setInstance($fms_db->getInstance());
$user->setView("v_usermaster");
$user->setParam("WHERE userID = '$username' LIMIT 0,1");
$user->doQuery("query");
$row_user = $user->getLists();
// CLOSING FMS DB
$fms_db->DBClose();
if($row_user[0]['userPass'] == $password){
$_SESSION['SYS_USERID'] = $username;
$_SESSION['SYS_UNAME'] = $row_user[0]['userName'];
$_SESSION['SYS_AVATAR'] = USERPICS . $username . '/' . $row_user[0]['userPic'];
$_SESSION['SYS_USERTYPE'] = $row_user[0]['userType'];
$_SESSION['SYS_USERLVL'] = $row_user[0]['accessLevel'];
// SET FMS DB
$fms_db = new DBCOnfig;
$fms_db->setFleetDB();
// SET USER ACCESS
$userassignee = new Table;
$userassignee->setSQLType($fms_db->getSQLType());
$userassignee->setInstance($fms_db->getInstance());
$userassignee->setView("v_userassigneemapper");
$userassignee->setParam("WHERE userID = '$username'");
$userassignee->doQuery("query");
$row_userassignee = $userassignee->getLists();
$num_userassignee = $userassignee->getNumRows();
// GET ASSIGNEE ID
$assigneeID = $row_userassignee[0]['assigneeID'];
// SET ASSIGNEE TO SESSION
$_SESSION['SYS_ASSIGNEE'] = $assigneeID;
// CLOSING FMS DB
$fms_db->DBClose();
$alert = new MessageAlert;
$alert->setURL(BASE_URL);
$alert->setMessage("Access Granted.");
$alert->Alert();
}else{
$alert = new MessageAlert;
$alert->setURL(BASE_URL . "login.php");
$alert->setMessage("Invalid username or password! Please relogin.");
$alert->Alert();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<title>AdminDesigns - A Responsive HTML5 Admin UI Framework</title>
<meta name="keywords" content="HTML5 Bootstrap 3 Admin Template UI Theme" />
<meta name="description" content="AdminDesigns - A Responsive HTML5 Admin UI Framework">
<meta name="author" content="AdminDesigns">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<? require_once(INCLUDE_PATH . "_font.php"); ?>
<? require_once(INCLUDE_PATH . "_theme_css.php"); ?>
<? require_once(INCLUDE_PATH . "_adminform_css.php"); ?>
<? require_once(INCLUDE_PATH . "_favicon.php"); ?>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="external-page sb-l-c sb-r-c">
<!-- Start: Main -->
<div id="main" class="animated fadeIn">
<!-- Start: Content-Wrapper -->
<section id="content_wrapper">
<!-- begin canvas animation bg -->
<div id="canvas-wrapper">
<canvas id="demo-canvas"></canvas>
</div>
<!-- Begin: Content -->
<section id="content">
<div class="admin-form theme-info" id="login1">
<div class="row mb15 table-layout">
<!-- <div class="col-xs-6 va-m pln">
<a href="dashboard.html" title="Return to Dashboard">
<img src="assets/img/logos/logo_white.png" title="AdminDesigns Logo" class="img-responsive w250">
</a>
</div> -->
<!-- <div class="col-xs-6 text-right va-b pr5">
<div class="login-links">
<a href="pages_login.html" class="active" title="Sign In">Sign In</a>
<span class="text-white"> | </span>
<a href="pages_register.html" class="" title="Register">Register</a>
</div>
</div> -->
</div>
<div class="panel panel-info mt10 br-n">
<div class="panel-heading heading-border bg-white">
<span class="panel-title hidden"><i class="fa fa-sign-in"></i>Register</span>
<div class="section row mn">
<div class="col-sm-6">
<a href="#" class="button btn-social facebook span-left mr5 btn-block">
<span><i class="fa fa-facebook"></i>
</span>Facebook</a>
</div>
<div class="col-sm-6">
<a href="#" class="button btn-social twitter span-left mr5 btn-block">
<span><i class="fa fa-twitter"></i>
</span>Twitter</a>
</div>
<!-- <div class="col-sm-4">
<a href="#" class="button btn-social googleplus span-left btn-block">
<span><i class="fa fa-google-plus"></i>
</span>Google+</a>
</div> -->
</div>
</div>
<!-- end .form-header section -->
<form method="post" id="login-form" name="login-form">
<div class="panel-body bg-light p30">
<div class="row">
<div class="col-sm-12 pr30">
<!-- <div class="section row hidden">
<div class="col-md-6">
<a href="#" class="button btn-social facebook span-left mr5 btn-block">
<span><i class="fa fa-facebook"></i>
</span>Facebook</a>
</div>
<div class="col-md-6">
<a href="#" class="button btn-social twitter span-left mr5 btn-block">
<span><i class="fa fa-twitter"></i>
</span>Twitter</a>
</div>
<div class="col-md-4">
<a href="#" class="button btn-social googleplus span-left btn-block">
<span><i class="fa fa-google-plus"></i>
</span>Google+</a>
</div>
</div> -->
<div class="section">
<label for="username" class="field-label text-muted fs18 mb10">Username</label>
<label for="username" class="field prepend-icon">
<input type="text" name="txtusername" id="txtusername" class="gui-input" placeholder="Enter username">
<label for="username" class="field-icon"><i class="fa fa-user"></i>
</label>
</label>
</div>
<!-- end section -->
<div class="section">
<label for="username" class="field-label text-muted fs18 mb10">Password</label>
<label for="password" class="field prepend-icon">
<input type="password" name="txtpassword" id="txtpassword" class="gui-input" placeholder="Enter password">
<label for="password" class="field-icon"><i class="fa fa-lock"></i>
</label>
</label>
</div>
<!-- end section -->
</div>
<!-- <div class="col-sm-5 br-l br-grey pl30">
<h3 class="mb25"> You'll Have Access To Your:</h3>
<p class="mb15">
<span class="fa fa-check text-success pr5"></span> Unlimited Email Storage</p>
<p class="mb15">
<span class="fa fa-check text-success pr5"></span> Unlimited Photo Sharing/Storage</p>
<p class="mb15">
<span class="fa fa-check text-success pr5"></span> Unlimited Downloads</p>
<p class="mb15">
<span class="fa fa-check text-success pr5"></span> Unlimited Service Tickets</p>
</div> -->
</div>
</div>
<!-- end .form-body section -->
<div class="panel-footer clearfix p10 ph15">
<button type="submit" class="button btn-primary mr10 pull-right">Login</button>
<label class="switch block switch-primary pull-left input-align mt10">
<input type="checkbox" name="remember" id="remember" checked>
<label for="remember" data-on="YES" data-off="NO"></label>
<span>Remember me</span>
</label>
</div>
<!-- end .form-footer section -->
<input type="hidden" id="login" name="login" value="1" />
</form>
</div>
</div>
</section>
<!-- End: Content -->
</section>
<!-- End: Content-Wrapper -->
</div>
<!-- End: Main -->
<!-- BEGIN: PAGE SCRIPTS -->
<!-- jQuery -->
<script type="text/javascript" src="vendor/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<!-- Bootstrap -->
<script type="text/javascript" src="assets/js/bootstrap/bootstrap.min.js"></script>
<!-- Page Plugins -->
<script type="text/javascript" src="assets/js/pages/login/EasePack.min.js"></script>
<script type="text/javascript" src="assets/js/pages/login/rAF.js"></script>
<script type="text/javascript" src="assets/js/pages/login/TweenLite.min.js"></script>
<script type="text/javascript" src="assets/js/pages/login/login.js"></script>
<!-- Theme Javascript -->
<script type="text/javascript" src="assets/js/utility/utility.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<!-- <script type="text/javascript" src="assets/js/demo.js"></script> -->
<script type="text/javascript" src="assets/admin-tools/admin-forms/js/jquery.validate.min.js"></script>
<!-- Page Javascript -->
<script type="text/javascript">
jQuery(document).ready(function() {
"use strict";
// Init Theme Core
Core.init();
// Init Demo JS
Demo.init();
// Init CanvasBG and pass target starting location
CanvasBG.init({
Loc: {
x: window.innerWidth / 2,
y: window.innerHeight / 3.3
},
});
$("#txtusername").focus();
$( "#login-form" ).validate({
errorClass: "state-error",
validClass: "state-success",
errorElement: "em",
rules: {
txtusername: {
required: true
},
txtpassword: {
required: true
}
},
messages:{
txtusername: {
required: 'Please enter username!'
},
txtpassword: {
required: 'Please enter password!'
}
}
});
});
</script>
<!-- END: PAGE SCRIPTS -->
</body>
</html>