function channel_client_disconnected_log($participant) { $db = sr_pdo(); $p_log = new ParticipantLog(); $p_log->type = 2; $p_log->room_id = $participant->room_id; $p_log->participant_name = $participant->name; $p_log->user_id = $participant->user_id; $p_log->is_registered_user = $participant->is_registered_user; $p_log->ip_address = $participant->ip_address; $p_log->time = $p_log->getCurrentTime(); try { $p_log->add($db); } catch (PDOException $e) { // failed to write the log echo $e; } }
/** * Write a log that the participant joined the room. */ function room_join_log($participant) { $db = sr_pdo(); $p_log = new ParticipantLog(); $p_log->type = 1; $p_log->room_id = $participant->room_id; $p_log->participant_name = $participant->name; $p_log->user_id = $participant->user_id; $p_log->is_registered_user = $participant->is_registered_user; $p_log->ip_address = $participant->ip_address; $p_log->time = $p_log->getCurrentTime(); try { $p_log->add($db); } catch (PDOException $e) { // failed to write the log } }