chtcont.php3:
The code is as follows:
<?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);
if (@odbc_fetch_into($result,0,&$rArr)){
if ($rArr[1]==$ps){
if ($rArr[3]>=(time()-1800)){
if ($rArr[2]){
$result=@odbc_exec($ConnID,"SELECT TOP 25 sTime,sCont,sNameFrom,sIDFrom,sNameTo,sIDTo,SeqID FROM ChtCont WHERE (bSecret=False OR (bSecret=True AND (sIDFrom=".$id." OR sIDTo=".$id." OR sIDTo=0))) AND (RoomID=".$rArr[4]." OR RoomID=0) ORDER BY SeqID DESC");
$lMax=-1;
while (@odbc_fetch_into($result,0,&$rArr)){
$sLine=$rArr[0]." ".$rArr[1];
if ($id==$rArr[3])
$sLine=str_replace("%m","you",$sLine);
else
$sLine=str_replace("%m",$rArr[2],$sLine);
if ($id==$rArr[5])
$sLine=str_replace("%g","you",$sLine);
else
$sLine=str_replace("%g",$rArr[4],$sLine);
$sLine.="<br>n";
if ($rArr[6]>$lMax) $lMax=$rArr[6];
$sCont=$sLine.$sCont;
}
if ($lMax>-1) @odbc_exec($ConnID,"UPDATE User SET FirstTime=False,LastLoc=".($lMax+1)." WHERE UserID=".$id);
}
}
else $sCont="<p align='center'>You have timed out</p><p align='center'>Press <a href='.' target='_top'>here</a>login again</p></body></html>";
}
else $sCont="<p align='center'>password is incorrect!</p><p align='center'>Press <a href='.' target='_top'>here</a>login again</p></body></html>";
}
else $sCont="<p align='center'>This user does not exist!</p><p align='center'>Press <a href='.' target='_top'>here</a> to log in again</p></body></html>";
}
@odbc_close($ConnID);
}
else $sCont="<p align='center'>System failure, unable to log in!</p></body></html>";
?>
<html>
<head>
<title>Chat content</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--link rel="stylesheet" href="" type="text/css"-->
</head>
<body>
<?php echo $sCont; ?>
[The copyright of this article is jointly owned by the author and Aoso.com. If you need to reprint it, please indicate the author and source]
The code is as follows:
<?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);
if (@odbc_fetch_into($result,0,&$rArr)){
if ($rArr[1]==$ps){
if ($rArr[3]>=(time()-1800)){
if ($rArr[2]){
$result=@odbc_exec($ConnID,"SELECT TOP 25 sTime,sCont,sNameFrom,sIDFrom,sNameTo,sIDTo,SeqID FROM ChtCont WHERE (bSecret=False OR (bSecret=True AND (sIDFrom=".$id." OR sIDTo=".$id." OR sIDTo=0))) AND (RoomID=".$rArr[4]." OR RoomID=0) ORDER BY SeqID DESC");
$lMax=-1;
while (@odbc_fetch_into($result,0,&$rArr)){
$sLine=$rArr[0]." ".$rArr[1];
if ($id==$rArr[3])
$sLine=str_replace("%m","you",$sLine);
else
$sLine=str_replace("%m",$rArr[2],$sLine);
if ($id==$rArr[5])
$sLine=str_replace("%g","you",$sLine);
else
$sLine=str_replace("%g",$rArr[4],$sLine);
$sLine.="<br>n";
if ($rArr[6]>$lMax) $lMax=$rArr[6];
$sCont=$sLine.$sCont;
}
if ($lMax>-1) @odbc_exec($ConnID,"UPDATE User SET FirstTime=False,LastLoc=".($lMax+1)." WHERE UserID=".$id);
}
}
else $sCont="<p align='center'>You have timed out</p><p align='center'>Press <a href='.' target='_top'>here</a>login again</p></body></html>";
}
else $sCont="<p align='center'>password is incorrect!</p><p align='center'>Press <a href='.' target='_top'>here</a>login again</p></body></html>";
}
else $sCont="<p align='center'>This user does not exist!</p><p align='center'>Press <a href='.' target='_top'>here</a> to log in again</p></body></html>";
}
@odbc_close($ConnID);
}
else $sCont="<p align='center'>System failure, unable to log in!</p></body></html>";
?>
<html>
<head>
<title>Chat content</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--link rel="stylesheet" href="" type="text/css"-->
</head>
<body>
<?php echo $sCont; ?>
[The copyright of this article is jointly owned by the author and Aoso.com. If you need to reprint it, please indicate the author and source]