include("classes/chat.class.php"); $user= new users(); if (!$user->isuser($_REQUEST['device'])) { header("location: newuser.php?device=".$_REQUEST['device']); exit(); } $con= new connection(); $con->execute("update users set time='" . time() . "' where iduser='******'"); $chat= new chat(); $chat->closedeadrooms(); if(!$chatid=$_GET['idchat']) { if ($chatid=$chat->findchat($user->id)) { //echo "found chat"; $chat->joinchat($chatid,$user->id); }else{ $chatid=$chat->createchat($user->id); //echo "created chat"; } //echo $chatid; }