2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/core.php' ;
$posizione = $id_module ;
if ( isset ( $id_record )) {
$posizione .= ', ' . $id_record ;
}
2018-08-10 17:14:09 +02:00
$dbo -> query ( 'UPDATE zz_semaphores SET updated = NOW() WHERE id_utente = ' . prepare ( Auth :: user ()[ 'id' ]) . ' AND posizione = ' . prepare ( $posizione ));
2018-07-08 18:11:17 +02:00
$dbo -> query ( 'DELETE FROM zz_semaphores WHERE DATE_ADD(updated, INTERVAL ' . ( setting ( 'Timeout notifica di presenza (minuti)' ) * 2 ) . ' SECOND) <= NOW()' );
2017-09-04 10:24:44 +02:00
2018-08-10 17:14:09 +02:00
$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 ( Auth :: user ()[ 'id' ]) . ' AND posizione = ' . prepare ( $posizione ));
2017-08-04 16:28:16 +02:00
$result = [];
2017-09-04 10:24:44 +02:00
foreach ( $datas as $data ) {
$result [] = [
'username' => $data [ 'username' ],
];
2017-08-04 16:28:16 +02:00
}
echo json_encode ( $result );