mirror of https://github.com/IoTcat/ushio-auth.git
parent
4e877a914b
commit
1d19d8d30e
3 changed files with 59 additions and 0 deletions
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
include './functions.php'; |
||||
|
||||
$hash = $_GET['hash']; |
||||
if(!isset($hash)) die(); |
||||
|
||||
|
||||
header('Access-Control-Allow-Origin:https://user.yimian.xyz'); |
||||
header("Content-Type: application/json;charset=utf-8"); |
||||
|
||||
$cnn = db__connect(); |
||||
$cnnLog = db__connect('log'); |
||||
$res = db__getData($cnn, "token", 'hash', $hash); |
||||
|
||||
|
||||
$o = array(); |
||||
|
||||
foreach($res as $item){ |
||||
if($item['state']){ |
||||
$data = db__getData($cnn, 'fip', 'token', $item['token']); |
||||
$t = array(); |
||||
foreach($data as $r) array_push($t, $r['created_at']); |
||||
array_multisort($t, $data); |
||||
$item['fp'] = $data[count($data)-1]['fp']; |
||||
$item['ip'] = $data[count($data)-1]['ip']; |
||||
$log = db__getData($cnnLog, 'log_iis', 'fp', $item['fp'], 'ip', ip2long($item['ip'])); |
||||
if($log != 404){ |
||||
$item['log'] = $log; |
||||
} |
||||
array_push($o, $item); |
||||
} |
||||
} |
||||
|
||||
echo json_encode($o); |
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
include './functions.php'; |
||||
|
||||
$hash = $_GET['hash']; |
||||
$token = $_GET['token']; |
||||
if(!isset($hash) || !isset($token)) die(); |
||||
|
||||
|
||||
header('Access-Control-Allow-Origin:https://user.yimian.xyz'); |
||||
header("Content-Type: application/json;charset=utf-8"); |
||||
|
||||
$cnn = db__connect(); |
||||
|
||||
db__pushData($cnn, "token", array( |
||||
"state" => 0, |
||||
"updated_at" => date("Y-m-d H:i:s") |
||||
), array( |
||||
"token" => $token, |
||||
"hash" => $hash |
||||
)); |
||||
|
||||
echo json_encode(array("status"=>true)); |
Loading…
Reference in new issue