-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
284 lines (235 loc) · 11.4 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
<title>Dashboard</title>
<link rel="icon" type="image/x-icon" href="../src/assets/img/smc-logo.png"/>
<link href="layouts/vertical-dark-menu/css/light/loader.css" rel="stylesheet" type="text/css" />
<link href="layouts/vertical-dark-menu/css/dark/loader.css" rel="stylesheet" type="text/css" />
<script src="layouts/vertical-dark-menu/loader.js"></script>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet">
<link href="src/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="layouts/vertical-dark-menu/css/light/plugins.css" rel="stylesheet" type="text/css" />
<link href="src/assets/css/light/authentication/auth-boxed.css" rel="stylesheet" type="text/css" />
<link href="layouts/vertical-dark-menu/css/dark/plugins.css" rel="stylesheet" type="text/css" />
<link href="src/assets/css/dark/authentication/auth-boxed.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
</head>
<body class="form">
<!-- BEGIN LOADER -->
<div id="load_screen"> <div class="loader"> <div class="loader-content">
<div class="spinner-grow align-self-center"></div>
</div></div></div>
<!-- END LOADER -->
<div class="auth-container d-flex">
<div class="container mx-auto align-self-center">
<div class="row">
<div class="col-xxl-4 col-xl-5 col-lg-5 col-md-8 col-12 d-flex flex-column align-self-center mx-auto">
<div class="card mt-3 mb-3">
<div class="card-body">
<div class="row">
<div class="col-md-12 mb-3" style="text-align: center;">
<img src="src/assets/img/swer3-logo.png" style="height:136px;">
</div>
<form class="row g-3" action="php-includes/login.php" method="post">
<div class="col-md-12">
<div class="mb-3">
<label class="form-label">Username</label>
<input type="text" class="form-control" name="username" placeholder="Enter your username" >
</div>
</div>
<div class="col-12">
<div class="mb-4">
<label class="form-label">Password</label>
<input type="password" class="form-control" name="password" placeholder="Enter your password">
</div>
</div>
<div class="col-12">
<div class="mb-4">
<button type="submit" class="btn btn-primary w-100" >SIGN IN</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- BEGIN GLOBAL MANDATORY SCRIPTS -->
<script src="src/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- END GLOBAL MANDATORY SCRIPTS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$(document).ready(function(){
$("#btn-eye-show").css('display','none');
//Clear TextBox ===============================================================================
var timesRun = 0;
var interval = setInterval(function () {
$('#txt-username').val("");
$('#txt-password').val("");
timesRun += 1;
if(timesRun === 1){
clearInterval(interval);
}
//console.log(timesRun);
}, 1000);
$(window).click(function() {
var username = $('#txt-username').val();
var password = $('#txt-password').val();
$('#txt-username').val(username);
$('#txt-password').val(password);
});
//Clear TextBox End ============================================================================
//Tab Functions ================================================================================
$('body').on('keydown', '#txt-username', function(e) {
if (e.which == 9) {
e.preventDefault();
// do your code
var username = $('#txt-username').val();
$('#txt-username').val(username);
$('#txt-password').focus();
}
});
$('body').on('keydown', '#txt-password', function(e) {
if (e.which == 9) {
e.preventDefault();
// do your code
var username = $('#txt-password').val();
$('#txt-password').val(username);
$('#btn-signIn').focus();
}
});
//Tab Functions End =============================================================================
function userSession() {
return JSON.parse(localStorage.getItem("user"));
}
// Check User Session =================================================================
setInterval(() => {
isLogin();
}, 1000);
function isLogin(){
if(userSession()) {
$.ajax({
url:"system/api/sabong/sb-check-user-session.php",
method: "GET",
data: {
username: userSession().username,
session: 'checkUserSession'
},
success: function(data) {
const res = JSON.parse(data);
if(res.data.user_session_id === userSession().user_session_id && res.data.username === userSession().username){
sessionStorage.setItem("user", JSON.stringify(res.data));
window.location.replace("/system/main/arena/dashboard.php");
}
}
});
}
}
// Check User Session =============================================================
//Alerts ========================================================================================
var alertTrigger = document.getElementById('btn-signIn');
if (alertTrigger) {
alertTrigger.addEventListener('click', function () {
if($('#txt-username').val() == "" || $('#txt-password').val() == "") {
Swal.fire({
position: 'center',
icon: 'info',
title: "<h5 style='color:white'> Please input your username and password! </h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
});
} else {
var username = $("#txt-username").val();
var password = $("#txt-password").val();
$.ajax({
url:"system/api/sabong/getuser.php",
method: "GET",
data: {username: username,
password: password,
user: 'userlogin'
},
success: function(data) {
var res = JSON.parse(data);
if(res){
sessionStorage.setItem("user", JSON.stringify(res));
localStorage.setItem("user", JSON.stringify(res));
}
if(res.msg == "Deactivated"){
Swal.fire({
position: 'center',
icon: 'error',
title: "<h5 style='color:white'> Account Deactivated! </h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
});
return;
} else if (res.msg == "Canceled"){
Swal.fire({
position: 'center',
icon: 'error',
title: "<h5 style='color:white'> Account Canceled! </h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
});
return;
} else if (res.msg == "Agent"){
Swal.fire({
position: 'center',
icon: 'error',
title: "<h5 style='color:white'> This is agent account, please login to Agent Dashboard! </h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
}).then(function() {
window.location.replace("https://agent.sabongmastercup.com");
});
return;
}
if(Object.keys(res).length > 1){
Swal.fire({
position: 'center',
icon: 'success',
title: "<h5 style='color:white'> Welcome " + res.username + "</h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
}).then(function() {
window.location.replace("system/main/arena/dashboard.php");
});
} else {
Swal.fire({
position: 'center',
icon: 'error',
title: "<h5 style='color:white'> Wrong username or password! </h5>",
showConfirmButton: false,
background: '#333333',
width: '300px',
timer: 1500,
});
}
}
}); //ajax end
}
})
}
//Alerts End =====================================================================================
});
</script>
</body>
</html>