forked from devcode-it/openstamanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcall.php
22 lines (16 loc) · 808 Bytes
/
call.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include_once __DIR__.'/core.php';
$posizione = $id_module;
if (isset($id_record)) {
$posizione .= ', '.$id_record;
}
$dbo->query('UPDATE zz_semaphores SET updated = NOW() WHERE id_utente = '.prepare($_SESSION['id_utente']).' AND posizione = '.prepare($posizione));
$dbo->query('DELETE FROM zz_semaphores WHERE DATE_ADD(updated, INTERVAL '.(get_var('Timeout notifica di presenza (minuti)') * 2).' SECOND) <= NOW()');
$datas = $dbo->fetchArray('SELECT DISTINCT username FROM zz_semaphores INNER JOIN zz_users ON zz_semaphores.id_utente=zz_users.id WHERE zz_semaphores.id_utente != '.prepare($_SESSION['id_utente']).' AND posizione = '.prepare($posizione));
$result = [];
foreach ($datas as $data) {
$result[] = [
'username' => $data['username'],
];
}
echo json_encode($result);