-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathajax.php
30 lines (27 loc) · 935 Bytes
/
ajax.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
<?php
/**
* User Login
*/
require $_SERVER['DOCUMENT_ROOT']. '/captcha/geetest.php';
use CaptchaValidator\Geetest;
if (isset($_POST['action']) && $_POST['action'] === 'user-login') {
$user = $_POST['username'];
$pass = $_POST['password'];
$postCaptcha = json_decode($initCaptcha->verify($_POST['lot_number'], $_POST['captcha_output'], $_POST['pass_token'], $_POST['gen_time']), true);
if (isset($postCaptcha) && $postCaptcha['status'] !== 'success') {
exit(json_encode([
"status" => "error",
"msg" => Geetest::Error($postCaptcha['reason'])
]));
} else if ($user === 'admin' && $pass == 123456) {
exit(json_encode([
"status" => "success",
"msg" => "Đăng nhập thành công."
]));
} else {
exit(json_encode([
"status" => "error",
"msg" => "Thông tin đăng nhập không chính xác!"
]));
}
}