You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
1 year ago
|
<?php
|
||
|
|
||
|
/*===============================================*\
|
||
|
|| ############################################# ||
|
||
|
|| # JAKWEB.CH / Version 1.0.3 # ||
|
||
|
|| # ----------------------------------------- # ||
|
||
|
|| # Copyright 2019 JAKWEB All Rights Reserved # ||
|
||
|
|| ############################################# ||
|
||
|
\*===============================================*/
|
||
|
|
||
|
if (!file_exists('../../config.php')) die('ajax/[available.php] config.php not exist');
|
||
|
require_once '../../config.php';
|
||
|
|
||
|
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !isset($_SESSION['jak_lcp_idhash'])) die("Nothing to see here");
|
||
|
|
||
|
if (!is_numeric($_POST['id'])) die("There is no such user!");
|
||
|
|
||
|
// Sanitize the user status
|
||
|
$ustatus = filter_var($_POST['ops'], FILTER_SANITIZE_NUMBER_INT);
|
||
|
|
||
|
// Set status to false
|
||
|
$status = 0;
|
||
|
|
||
|
// Check if user is logged in
|
||
|
if (JAK_USERID) {
|
||
|
// Update User
|
||
|
$jakdb->update("user", ["available" => $ustatus, "lastactivity" => time(), "session" => session_id()], ["id" => JAK_USERID]);
|
||
|
// Check if it is succesful
|
||
|
$status = 1;
|
||
|
}
|
||
|
|
||
|
die(json_encode(array('status' => $status, 'usrstatus' => $ustatus)));
|
||
|
|
||
|
?>
|