-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathajax.php
More file actions
57 lines (48 loc) · 1.4 KB
/
ajax.php
File metadata and controls
57 lines (48 loc) · 1.4 KB
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
<?php
define('ROOT', dirname(__FILE__) . '/');
include_once ROOT . 'include/functions.php';
date_default_timezone_set('Asia/Shanghai');
if (file_exists('proxy.php')) {
include 'proxy.php';
}
if (!defined('proxy')) {
define('proxy', false);
}
$json = new sjsonpack();
$post = APOST();
$email = $post['email'];
$password = !empty($post['password']) ? $post['password'] : '';
$remember = isset($post['remember']) ? $post['remember'] : false;
$lode_type = isset($post['loadType']) ? $post['loadType'] : 'include';
if (isset($post['action'])) {
switch ($post['action']) {
case 'usecookie':
$si_string = '';
if (isset($_COOKIE['si_string'])) {
$si_string = explode("\t", authcode($_COOKIE['si_string']));
}
if (!!$si_string) {
list($email, $password) = $si_string;
}
case 'login':
if (!preg_match('#\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*#', $email)) {
$json->setMsg('invailed email');
break;
}
if ($remember) {
ssetcookie('si_string', authcode(implode("\t", [$email, $password]), 'ENCODE'));
}
$gamelogin = new kanlogin($email, $password, $lode_type, $remember);
$login_result = $gamelogin->login();
if ($login_result) {
$json->success();
}
break;
default :
$json->setMsg('watch your magic');
break;
}
} else {
$json->setMsg('watch your magic');
}
exit($json);