Push new session handling
This commit is contained in:
parent
75de51ec14
commit
b99f4c3140
8 changed files with 182 additions and 7 deletions
|
@ -20,6 +20,7 @@ $title = "";
|
|||
$login = false;
|
||||
$reason = "Unauthorized";
|
||||
$active = false;
|
||||
$token = "";
|
||||
|
||||
$clientKey = $js['clientKey'];
|
||||
if($clientKey == CLIENTPSK) {
|
||||
|
@ -43,6 +44,9 @@ if($clientKey == CLIENTPSK) {
|
|||
|
||||
$reason = "success";
|
||||
$login=true;
|
||||
|
||||
$token = gen_uuid();
|
||||
$DB->query("UPDATE `auth` SET `webLoginKey`='$token' WHERE `UUID` = '$id';");
|
||||
} else {
|
||||
$reason = "Invalid Password";
|
||||
}
|
||||
|
@ -64,7 +68,8 @@ die(json_encode(
|
|||
"last" => $last,
|
||||
"title" => $title,
|
||||
"rez" => $rez,
|
||||
"active" => $active
|
||||
"active" => $active,
|
||||
"token" => $token
|
||||
)
|
||||
)
|
||||
));
|
||||
|
|
29
php/ValidateToken.php
Normal file
29
php/ValidateToken.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
if(!defined("COMMON"))
|
||||
require("Common.php");
|
||||
|
||||
$js = getJsonizedInput();
|
||||
|
||||
$token = $js["token"];
|
||||
$client = $js["client"];
|
||||
|
||||
$DB = get_DB();
|
||||
$id = "";
|
||||
|
||||
$res = $DB->query("SELECT * FROM `auth`;");
|
||||
if($res->num_rows != 0){
|
||||
while($row = $res->fetch_assoc()){
|
||||
if(md5($row['webLoginKey']) == $token) {
|
||||
$id = $row["UUID"];
|
||||
}
|
||||
}
|
||||
}
|
||||
die(json_encode(
|
||||
array(
|
||||
"id" => md5($id),
|
||||
"type" => "S2CSessionCheck"
|
||||
)
|
||||
));
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue