من دارم يه chatroom با php مينويسم ولي يه مشكل بزرگ دارم از تابمر استفاده كردم ولي هر دفعه كه تايمر ميره تو صفحه check message.php فقط يه پيغام خاص برميگردونه حتي وقتي با يه id ديگه login ميكنم
ميگم شايد همش از تو cache ميخونه؟
ميشه كمكم كنيد!
اين هم كدهاي من :

ميگم شايد همش از تو cache ميخونه؟

ميشه كمكم كنيد!
اين هم كدهاي من :
- chat.php -
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<script language="javascript" type="text/javascript">
var reciever;
var sender;
var mTimer;
var y=new ActiveXObject("Microsoft.XMLHTTP");;
function CheckBankFunc()
{
var obj= document.getElementById("txt1");
obj.value++;
y=new ActiveXObject("Microsoft.XMLHTTP");
var senderrecieve=document.getElementById("id").value;
y.open("get","check_message.php?userid="+senderrecieve,true);
y.onreadystatechange=function(){
if(y.readyState==4 && y.status==200)
{
document.getElementById("TextArea1").value+='\n'+ y.responseText;
}
}
y.send(null);
clearInterval(mTimer);
}
function StartTimer()
{
mTimer = setInterval('CheckBankFunc();',2000);
}
function select_online()
{
reciever=document.getElementById("s1").value;
}
function select_offline()
{
reciever=document.getElementById("s2").value;
}
function saveinformation()
{
var x;
var message;
message=document.getElementById("TextArea2").value;
sender=document.getElementById("id").value;
var date = new Date();
var d = date.getDate();
var m = date.getMonth()+1;
var yy = date.getYear();
var tarikh=yy+"-"+m+"-"+d;
x=new ActiveXObject("Microsoft.XMLHTTP");
x.open("get","save_message.php?chattext="+message+"&sender="+sender+"&reciever="+reciever+"&date="+tarikh,true);
x.onreadystatechange=function(){
if(x.readyState==4)
{
document.getElementById("TextArea1").value+='\n'+document.getElementById("username").value+"("+tarikh+")"+":"+document.getElementById("TextArea2").value;
}
}
x.send(null);
StartTimer();
}
</script>
</HEAD>
<BODY onload="StartTimer()">
<form method="post" action="exit.php">
<?php
$link=mysql_connect("localhost","root","");
$cnn=mysql_selectdb("chatroom",$link);
$ds=mysql_query("select * from register where (username='".$_POST[txt_username]."') and (password='".$_POST[txt_password]."') ",$link);
$row=mysql_fetch_array($ds);
if(!$row)
header("Location:login.php");
else
$ds1=mysql_query("update register set logstatus=1 where userid='".$row[userid]."'",$link);
?>
<input type="hidden" name="id" value="<?php echo $row[userid]; ?>">
<input type="hidden" name="username" value="<?php echo $row[username]; ?>">
<table>
<tr>
<td>
<textarea name="TextArea1" style="height:300; width:400" readonly="true"></textarea>
</td>
</tr>
<tr>
<td>Online: <select name="s1" style="width:150;" onchange="select_online()">
<option value=0>Please Select</option>
<?php
$ds2=mysql_query("select * from register where logstatus=1",$link);
while($rowid=mysql_fetch_array($ds2))
{
?>
<option value="<?php echo $rowid[userid]; ?>"><?php echo $rowid[username]; ?></option>
<?php
}
?>
</select>
Offline: <select id="s2" style="width:150;" onchange="select_offline()">
<option value=0>Please Select</option>
<?php
$ds3=mysql_query("select * from register where logstatus=0",$link);
while($rowid=mysql_fetch_array($ds3))
{
?>
<option value="<?php echo $rowid[userid]; ?>"><?php echo $rowid[username]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
<textarea name="TextArea2" style="height:50; width:400"></textarea>
</td>
<td>
<input name="btn_send" type="button" value="Send" style="height:50; width=60" onclick="saveinformation()"/></td>
</tr>
<tr>
<td align="center">
<br>
<input name="btn_exit" type="submit" value="Exit" style="height:30; width=60"/>
</td>
<td><input type="text" id="txt1" /></td>
</tr>
</table>
</form>
</BODY>
</HTML>
----------------->checkmessage.php<----------------
<?php
$text="";
$link=mysql_connect("localhost","root","");
$cnn=mysql_selectdb("chatroom",$link);
$ds=mysql_query("select * from chatlog where (recieverid=".$_GET[userid].") and (isview=0)",$link);
$row=mysql_fetch_array($ds);
$ds1=mysql_query("select * from register where (userid='".$row[senderid]."')",$link);
$row1=mysql_fetch_array($ds1);
echo $row1[username]."(".$row[chatdate].")".":".$row[chattext];
$ds=mysql_query("update chatlog set isview=1 where logid='".$row[logid]."'",$link);
mysql_close($link);
<?
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<script language="javascript" type="text/javascript">
var reciever;
var sender;
var mTimer;
var y=new ActiveXObject("Microsoft.XMLHTTP");;
function CheckBankFunc()
{
var obj= document.getElementById("txt1");
obj.value++;
y=new ActiveXObject("Microsoft.XMLHTTP");
var senderrecieve=document.getElementById("id").value;
y.open("get","check_message.php?userid="+senderrecieve,true);
y.onreadystatechange=function(){
if(y.readyState==4 && y.status==200)
{
document.getElementById("TextArea1").value+='\n'+ y.responseText;
}
}
y.send(null);
clearInterval(mTimer);
}
function StartTimer()
{
mTimer = setInterval('CheckBankFunc();',2000);
}
function select_online()
{
reciever=document.getElementById("s1").value;
}
function select_offline()
{
reciever=document.getElementById("s2").value;
}
function saveinformation()
{
var x;
var message;
message=document.getElementById("TextArea2").value;
sender=document.getElementById("id").value;
var date = new Date();
var d = date.getDate();
var m = date.getMonth()+1;
var yy = date.getYear();
var tarikh=yy+"-"+m+"-"+d;
x=new ActiveXObject("Microsoft.XMLHTTP");
x.open("get","save_message.php?chattext="+message+"&sender="+sender+"&reciever="+reciever+"&date="+tarikh,true);
x.onreadystatechange=function(){
if(x.readyState==4)
{
document.getElementById("TextArea1").value+='\n'+document.getElementById("username").value+"("+tarikh+")"+":"+document.getElementById("TextArea2").value;
}
}
x.send(null);
StartTimer();
}
</script>
</HEAD>
<BODY onload="StartTimer()">
<form method="post" action="exit.php">
<?php
$link=mysql_connect("localhost","root","");
$cnn=mysql_selectdb("chatroom",$link);
$ds=mysql_query("select * from register where (username='".$_POST[txt_username]."') and (password='".$_POST[txt_password]."') ",$link);
$row=mysql_fetch_array($ds);
if(!$row)
header("Location:login.php");
else
$ds1=mysql_query("update register set logstatus=1 where userid='".$row[userid]."'",$link);
?>
<input type="hidden" name="id" value="<?php echo $row[userid]; ?>">
<input type="hidden" name="username" value="<?php echo $row[username]; ?>">
<table>
<tr>
<td>
<textarea name="TextArea1" style="height:300; width:400" readonly="true"></textarea>
</td>
</tr>
<tr>
<td>Online: <select name="s1" style="width:150;" onchange="select_online()">
<option value=0>Please Select</option>
<?php
$ds2=mysql_query("select * from register where logstatus=1",$link);
while($rowid=mysql_fetch_array($ds2))
{
?>
<option value="<?php echo $rowid[userid]; ?>"><?php echo $rowid[username]; ?></option>
<?php
}
?>
</select>
Offline: <select id="s2" style="width:150;" onchange="select_offline()">
<option value=0>Please Select</option>
<?php
$ds3=mysql_query("select * from register where logstatus=0",$link);
while($rowid=mysql_fetch_array($ds3))
{
?>
<option value="<?php echo $rowid[userid]; ?>"><?php echo $rowid[username]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
<textarea name="TextArea2" style="height:50; width:400"></textarea>
</td>
<td>
<input name="btn_send" type="button" value="Send" style="height:50; width=60" onclick="saveinformation()"/></td>
</tr>
<tr>
<td align="center">
<br>
<input name="btn_exit" type="submit" value="Exit" style="height:30; width=60"/>
</td>
<td><input type="text" id="txt1" /></td>
</tr>
</table>
</form>
</BODY>
</HTML>
----------------->checkmessage.php<----------------
<?php
$text="";
$link=mysql_connect("localhost","root","");
$cnn=mysql_selectdb("chatroom",$link);
$ds=mysql_query("select * from chatlog where (recieverid=".$_GET[userid].") and (isview=0)",$link);
$row=mysql_fetch_array($ds);
$ds1=mysql_query("select * from register where (userid='".$row[senderid]."')",$link);
$row1=mysql_fetch_array($ds1);
echo $row1[username]."(".$row[chatdate].")".":".$row[chattext];
$ds=mysql_query("update chatlog set isview=1 where logid='".$row[logid]."'",$link);
mysql_close($link);
<?