Replaced online check
This commit is contained in:
parent
2e3cb18560
commit
51df554065
|
@ -657,6 +657,16 @@ class user
|
|||
$this->log("User removed", null, $removed_by, date("d/m/Y"), date("H:i.s"));
|
||||
$this->tools->profiler_stop();
|
||||
}
|
||||
|
||||
public function online_time_update($id=null){
|
||||
$this->tools->profiler_start("Update online timestamp");
|
||||
if(is_null($id)) $id = $this->auth->getUserId();
|
||||
$time = time();
|
||||
$sql = "UPDATE `%PREFIX%_profiles` SET online_time = '$time' WHERE id = '" . $id ."'";
|
||||
$this->database->exec($sql, true);
|
||||
bdump(["id" => $id, "time" => $time]);
|
||||
$this->tools->profiler_stop();
|
||||
}
|
||||
}
|
||||
|
||||
class translations
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
include_once '../../core.php';
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
if(isset($_POST["change_id"]) && $_POST["dispo"] == 1 && $_POST["token_list"] == $_SESSION['token_list']){
|
||||
$risultato = $database->exec("UPDATE `%PREFIX%_profiles` SET `available` = '1' WHERE `%PREFIX%_profiles`.`id` = :id;", false, [":id" => $_POST["change_id"]]);
|
||||
$user->log("Attivazione disponibilita'", $_POST["change_id"], $user->auth->getUserId(), date("d/m/Y"), date("H:i.s"));
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
$start = true;
|
||||
$minutes = 5;
|
||||
include_once "../../core.php";
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
|
||||
function arraynum(){
|
||||
global $database;
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY available DESC, chief DESC, services ASC, name ASC", true);
|
||||
$incremento = array();
|
||||
$availability_minutes_old = array();
|
||||
foreach($risultato as $row){
|
||||
if($row['available'] == "1"){
|
||||
$incremento[] = $row['name'];
|
||||
$availability_minutes_old[] = $row['availability_minutes'];
|
||||
}
|
||||
}
|
||||
|
||||
return $incremento;
|
||||
}
|
||||
|
||||
if(!isset($_GET['name'])){
|
||||
print_r(arraynum());
|
||||
} else {
|
||||
if(isset($_GET['name'])){
|
||||
$arr = arraynum();
|
||||
$name = str_replace("_", " ", $_GET['name']);
|
||||
if(in_array($name, $arr)){
|
||||
echo "si";
|
||||
} else {
|
||||
echo "no";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -2,6 +2,7 @@
|
|||
include_once("../../core.php");
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY available DESC, chief DESC, services ASC, availability_minutes ASC, name ASC;", true);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
include_once("../../core.php");
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_log` ORDER BY `date` DESC, `time` DESC", true);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
include_once("../../core.php");
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_services` ORDER BY data DESC, uscita DESC", true);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
include_once("../../core.php");
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_trainings` ORDER BY data DESC, inizio desc", true);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
include_once("../../core.php");
|
||||
init_class();
|
||||
$user->requirelogin(false);
|
||||
$user->online_time_update();
|
||||
|
||||
$risultato = $database->exec('SELECT * FROM `%PREFIX%_profiles` WHERE id = :id', true, array(":id" => $_GET['user'])); // Pesco i dati della table
|
||||
|
||||
|
|
|
@ -313,27 +313,6 @@
|
|||
I agree
|
||||
</button>
|
||||
</div>
|
||||
{% if user.autenticated %}
|
||||
<script>
|
||||
function check() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '{{ urlsoftware }}online_check.php');
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
console.log('Text ' + xhr.responseText);
|
||||
} else {
|
||||
console.log('Request failed. Returned status of ' + xhr.status);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
//check();
|
||||
/* setInterval(function() {
|
||||
check();
|
||||
}, 30000); */
|
||||
</script>
|
||||
{% endif %}
|
||||
{% block menu %}
|
||||
<!-- Menu -->
|
||||
<div class="topnav" id="myTopnav">
|
||||
|
|
Loading…
Reference in New Issue