Location: PHPKode > projects > X-kernoel-x.NET Chat Engine > xchatx-0.1/read.php
<?
/*********************************************************************************
x-kernoel-x.NET Chat Engine is Copyright (c) 2002 by Markus Duft
You can reach me ofer E-Mail at: hide@address.com
This peace of Software underlies the GPL General Public License
Feel free to take peaces of this software for your own programs, but please let me know,
and leave a copyright notice where you use something out of this script!
*********************************************************************************/
?>

<html><head>
</head><body bgcolor="#000000" text="#ffffff">

<script language="javascript">

function reload_p() {
	window.location.replace('read.php?user=<? echo $user; ?>&last=<? echo $last; ?>');
}
</script>

<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="100%">
			<div align="center">
				<a href="javascript:reload_p()"><font face="Arial" size="3" color="#000000">R</a></font>
			</div>
		</td>
	</tr>
</table>

<script language="JavaScript" src="functions.js"></script>
<script language="php">

set_time_limit(1200);

include("includes/config.inc.php");
include("includes/class.database.php");

$db = new Database($db_host,$db_name,$db_user,$db_pass);
$sql = "SELECT * FROM on_user WHERE name='$user'";
$db->query($sql);
$db->nextRecord();
$room = $db->getField(3);
$sql = "SELECT * FROM chat WHERE id > '$last'";

while(!$num) {
usleep(500000);
$db->query($sql);
$num = $db->numRows();
}

echo "<script language=\"javascript\">";

	for($i=0;$i<$num;$i++) {
		$db->nextRecord();
		$n_user = $db->getField(3);
		$n_sql = "SELECT * FROM on_user WHERE name = '$n_user'";
		$n_db = new Database($db_host,$db_name,$db_user,$db_pass);
		$n_db->query($n_sql);
		$n_db->nextRecord();
		$status = $n_db->getField(5);
		$type = explode(":",$db->getField(5));
		switch($type[0]) {
			case "normal":
				if($status != "gag") {
					if($db->getField(1) == $room) {
//						if($db->getField(3) != $user) {
							echo "PrintChat(\"".$db->getField(2)."\");\n";
//						}
					}
				}
				break;
			case "whisper":
//				if($db->getField(3) != $user) {
					if($type[1] == $user) {
						echo "PrintChat(\"".$db->getField(2)."\");\n";
					}
//				}
				break;
			case "sysmsg":
				echo "PrintChat(\"".$db->getField(2)."\");\n";
				break;
		}
	}
	$last = $db->getField(0);	

echo "setTimeout(\"window.location.replace('read.php?user=$user&last=$last')\",10);\n";
echo "</script>";

</script>

</body>
Return current item: X-kernoel-x.NET Chat Engine