Location: PHPKode > scripts > Some Chess > some-chess/chat.php
<?php 
//		Some Chess, a PHP multi-player chess server.
//		Copyright (C) 2006 Jon Link
session_start(); 
require_once('loginon.php');
require_once('config.php');
include_once('languages/'.$lang.'_main.php');
include_once('standard.php');
include_once('constants.php');
$name		= validate($_SESSION['name']);
$id			= validate($_SESSION['id']);
$gameID		= validate($_GET['gameID']);
if($chatRefresh)header('refresh: '.$chatRefresh.'; url=chat.php?gameID='.$gameID);
echo'<html><body><style type="text/css">
		body {font:0.9em helvetica, arial, monaco;line-height:1.2em;}
		#chat {background:#dbdbdb url("img/boxShadow.gif") repeat-x;border:1px solid gray;position:absolute;top:0px;left:0px;width:220px;height:320px;}
		body>#chat {height:340px;}
		#inChat {padding:5px;overflow:auto;width:180px;height:310px;font:0.9em Sabon, Georgia, Arial;}
		#chat>#inChat {width:210px;height:330px;}		
		h3 {font:bold 1em Helvetica, Arial;margin:0 0 15px 0;color:#2F3953;}
		b {font-family:Helvetica, Arial;}
		.you {color:#476DB7;margin-top:7px;}
		.them {color:#163970;margin-top:7px;}
	</style>';
$queryChat		= 'SELECT playerName,text FROM chat WHERE gameID="'.$gameID.'" ORDER BY num DESC LIMIT 40';
$resultChat		= mysql_query($queryChat) or die('<div class="error">'.errorDBStr.'chat</div>');	
$chatNum		= mysql_num_rows($resultChat);
echo'<div id="chat">
	<div id="inChat">
	<h3>'.$chatStr[0].'</h3>';
for($c=0;$c<$chatNum;++$c){
	$chatName	= mysql_result($resultChat,$c,'playerName');
	$div 		= ($chatName == $name)? 'you':'them';
	$text 		.= wordwrap(('<div class="'.$div.'"><b>'.$chatName.'</b>: '.(mysql_result($resultChat,$c,'text')).'</div>'),58);
}
echo $text;
?>
</body>
</html>
Return current item: Some Chess