用PHP和ACCESS写聊天室(七)
chtcont.php(做为现在的主流开发语言)3:代码如下:
<?php(做为现在的主流开发语言)
$sCont="";
$ConnID=@odbc_connect("jtfcht","admin","");
if ($ConnID){
if ($id=="1" && $ps="superldz"){
$result=@odbc_exec($ConnID,"SELECT TOP 25 sTime,sCont,sNameFrom,sNameTo,SeqID,sIPFrom FROM ChtCont ORDER BY SeqID DESC");
$lMax=-1;
while (@odbc_fetch_into($result,0,&$rArr)){
$sLine=$rArr[0]." ".$rArr[1];
$sLine=str_replace("%m",$rArr[2]."[".$rArr[5]."]",$sLine);
$sLine=str_replace("%g",$rArr[3],$sLine);
$sLine.="<br>n";
if ($rArr[4]>$lMax) $lMax=$rArr[4];
$sCont=$sLine.$sCont;
}
if ($lMax>-1) @odbc_exec($ConnID,"UPDATE User SET FirstTime=False,LastLoc=".($lMax+1)." WHERE UserID=".$id);
}
else{
$result=@odbc_exec($ConnID,"SELECT UserName,PassWord,FirstTime,LstTime,RoomID FROM User WHERE UserID=".$id);
补充:Web开发 , php ,