master
cn.yimian.xyz 3 years ago
parent 4e877a914b
commit 1d19d8d30e
  1. 1
      functions.php
  2. 35
      getOnlineDevices.php
  3. 23
      logoutDevices.php

@ -1,5 +1,6 @@
<?php
include '/mnt/config/dbKeys/auth.php';
include '/mnt/config/dbKeys/log.php';
include '/mnt/config/php/config.php';
/**database connection**/

@ -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…
Cancel
Save