https://api.telegram.org/bot<token>/messages.sendVote
CREATE TRIGGER tr_generate_unique_key BEFORE INSERT ON xf_user
FOR EACH ROW
SET NEW.unique_key = UUID();
$sql="select login,id,ip from web_users where (now() - online) > interval '".($timeout*60)."' AND session_id!=''";
$res=$db->query($sql);
while($arru=$res->fetch(PDO::FETCH_OBJ)){
$now = microtime(true);
$db->query("INSERT INTO events (event_date,event_time,ip_client,user_id,user_login,event_type,event_place,event_note,event_status,title) VALUES
('" . date("Y-m-d", $now) . "','" . date("H:i:s.", $now) . floor(($now-floor($now))*1000) . "',''," .$arru->id . ",'" . $arru->login . "',1,'','<tr><td>выход по таймауту</td></tr>',1,'')");
}
$db->query("UPDATE web_users SET online='1970-01-01 00:00:00.000000', session_id='' WHERE (now() - online) > interval '".($timeout*60)."'");