Location: PHPKode > projects > php Strategy Game Engine X > phpsgex/frchat.php
<?php

/* --------------------------------------------------------------------------------------
                                     CHAT SYSTEM
   Credits         : phpSGEx by Aldrigo Raffaele
   Last modified by: Fhizban 09.06.2013
   Comments        : No changes
-------------------------------------------------------------------------------------- */

require("func.php");
db_connect();
session_start();

if( isset($_SESSION['id']) && isset($_REQUEST['act']) ){
	if($_REQUEST['act']=="chat_rel"){
		$query=mysql_query("SELECT * FROM `".TB_PREFIX."chat` ORDER BY `id` DESC");	
		while( $lsm= mysql_fetch_array($query) ){
			echo "<a href='pg=profile&usr=".$lsm['usrid']."' target='_blank'>".$lsm['scr_username']."</a> : ".$lsm['msg']."<br>";
		}
	}	
	
	if($_REQUEST['act']=="chat_sendm"){
		$msg=html_entity_decode( htmlentities($_REQUEST['msg']) );	
		mysql_query("INSERT INTO `".TB_PREFIX."chat` (`id` ,`username` ,`usrid` ,`msg` ,`sent_on`) VALUES (NULL , '".$_REQUEST['reg_nickname']."', '".(int)$_SESSION['id']."', '".$msg."', CURRENT_TIMESTAMP);");
	}
}

?>
Return current item: php Strategy Game Engine X