Location: PHPKode > projects > AwodChat > awod/system/retr.php
<?php
session_start();
$start = microtime();

function is_banned($user) {
	if (file_exists("banned_user/".$user)) {
		return 1;
	} else {
	return 0;
	}
}
if($_SESSION['name']=="" or is_banned($_SESSION['name'])){ die("Login/banned."); }

$db=file("db/chat.db");
foreach ($db as $line) {
   $vars=explode("][", $line);
   $private=preg_replace("/\r|\n/s", "",$vars[4]);	
   if ($private!="0" and $private==$_SESSION['name']) {
   echo "<span style=\"font-size:9px;\">[".date("H:i", $vars[0])."]</span> <span style=\"cursor:pointer; font-weight:bold;\" onclick=\"add_sm('".$vars[1]."')\"> ".$vars[1]." -&gt; ".$private.": </span><span style=\"color:#".$vars[2]."\"> ".preg_replace("/\r|\n/s", "", $vars[3])."</span><br>\r\n";
   }
   if ($private=="0") {	
   echo "<span style=\"font-size:9px;\">[".date("H:i", $vars[0])."]</span> <span style=\"cursor:pointer; font-weight:bold;\" onclick=\"add_sm('".$vars[1]."')\"> ".$vars[1].": </span><span style=\"color:#".$vars[2]."\"> ".preg_replace("/\r|\n/s", "", $vars[3])."</span><br>\r\n";
   }
   if ($private!="0" and $private!=$_SESSION['name']) {	
   echo "<span style=\"font-size:9px;\">[".date("H:i", $vars[0])."]</span> <span style=\"cursor:pointer; font-weight:bold;\" onclick=\"add_sm('".$vars[1]."')\"> ".$vars[1]." -&gt; ".$private.": </span><span style=\"color:#".$vars[2]."\"> Private </span><br>\r\n";
   }

}
$t=time();
$ss=microtime()-$start;
echo "<div style=\"font-size:6px; display:block;\">".$ss." Sec</div>";

//UPDATE ONLINESTATUS
if (!file_exists("user/".$_SESSION['name'].".db")) {
$handler = fOpen("user/".$_SESSION['name'].".db" , "a+");
fWrite($handler , $t);
fClose($handler); 
}else{
unlink("user/".$_SESSION['name'].".db");
$handler = fOpen("user/".$_SESSION['name'].".db" , "a+");
fWrite($handler , $t);
fClose($handler); 
}
?>
Return current item: AwodChat