Просмотр файла functionChat.php

Размер файла: 1.43Kb
<?php      
/*
* W@Pchat
* Current Version : 1.2
* Author : Harris Yusuf Arifin (earthweb.biz)
* License : free
* You you can redistribute it and/or modify this script but please always put author's name
*/
 
function logoutMess($nickname,$timelogin)
{
	include("openDB.php"); 
	$timelogout=time();
 	$logoutmess=$nickname." <i>has logout</i>";
 	$sqlLogout ="insert into wapchat (mylogontime,mynick,mymess,messtime) values ('$timelogin','$nickname','$logoutmess','$timelogout')";
 	mysql_query($sqlLogout) or die(mysql_error()); 
 	mysql_close();
}


function delMess($nickname,$timelogin)
{
 	include("openDB.php"); 
 	$sqlDel="delete from wapchat where mynick='$nickname' and mylogontime='$timelogin'";
 	mysql_query($sqlDel) or die(mysql_error()); 
}                 


function dispMess($timelogin)
{           
	$i=0;
	include("openDB.php");
	$sqlMess="select mymess,mynick from wapchat where messtime >= '$timelogin' order by messtime desc limit $messlimit"; 
	$result=mysql_query($sqlMess) or die(mysql_error());    
	while ($row=mysql_fetch_row($result)) {
	$retVal[$i][0]=$row[0];
	$retVal[$i][1]=$row[1];  
	$i++;
	}
	return $retVal;	
}   

function countUserOnline(&$CountUser)
{        
	include("openDB.php");
	$sqlCount="select mymess from wapchat where mymess like '%<i>Welcome to the chatroom</i>%'";
	$result=mysql_query($sqlCount) or die(mysql_error()); 
	$CountUser=mysql_num_rows($result);
}
?>