'; if(empty($_SESSION["username"])){ echo "Username is mandatory. Connection Rejected"; return false; } if(isset($_GET["rid"]) && isset($_GET["roomName"])){ $_SESSION["roomId"] = $_GET["rid"]; $_SESSION["roomName"] = $_GET["roomName"]; } $typingEnabled = ""; if(isset($_SESSION["typingEnabled"]) && $_SESSION["typingEnabled"] == 0){ $typingEnabled = "disabled"; } $client = new RtmpClient(); $data = array($_SESSION["gender"],$_SESSION["username"],"","","user",0,0,"",$_SESSION["theToken"],"","","",$revision,$_COOKIE["userId"],getRealIpAddr()); $client->connect($host,$appName,$port,$data); if(isset($_GET["rid"])){ $client->joinRoom($_SESSION["roomId"],"",1); } //setting the last message $theChat = $client->getMessages($_SESSION["roomId"],$_COOKIE["userId"]); $history = array(); foreach($theChat as $j){ if(@strcmp($j["senderusername"],"r") != 0){ array_push($history, $j); } } // sorting the array usort($history, function($a, $b) { return $a['time'] - $b['time']; }); if(count($history) > 0){ setcookie("timeOfLastMessage",$history[count($history)-1]["time"]); }else{ setcookie("timeOfLastMessage",0); } //last message set echo "
Rooms

Welcome ".$_SESSION["username"]." to room ".$_SESSION["roomName"]."

Leave Chat
"; ?>
data-theme="b" data-mini="true" onkeydown="if (event.keyCode == 13) sendText();" /> Send Users