'; 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["thumbnailUrl"],$_SESSION["theToken"],$_SESSION["profileUrl"],$_SESSION["profileCountryFlag"],$_SESSION["clientUniqueIdentifier"],$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 function sortByTime($a, $b){ return $a['time'] - $b['time']; } usort($history,"sortByTime"); if(count($history) > 0){ setcookie("timeOfLastMessage",$history[count($history)-1]["time"]); }else{ setcookie("timeOfLastMessage",0); } //last message set echo "
".$_SESSION["AVC_btnRooms"]."

".$_SESSION["AVC_welcomeUser"]." ".$_SESSION["username"]." ".$_SESSION["AVC_welcomeToRoom"]." ".$_SESSION["roomName"]."

".$_SESSION["AVC_btnLeaveChat"]."
"; ?>
data-theme="b" data-mini="true" onkeydown="if (event.keyCode == 13) sendText();" />