Use PHP and ACCESS to write chat rooms (1)
Last Update:2017-05-14
Source: Internet
Author: User
The INDEX. PHP code is as follows! & Lt ;? Phpfunctiondelquot ($ sStr) {$ sstr_replace (chr (124), & quot;, $ sStr); $ sstr_replace (chr (39), & quot ;, $ s); $ sstr_replace (chr (34), & quot INDEX. PHP
The code is as follows!
Function delquot ($ sStr ){
$ S = str_replace (chr (124), "", $ sStr );
$ S = str_replace (chr (39), "", $ s );
$ S = str_replace (chr (34), "", $ s );
Return $ s;
}
If ($ cmdYes = "inbound "){
$ SUserName = htmlspecialchars (trim (delquot ($ sUserName )));
If ($ sUserName = "superldz" & $ sPass = "superldz "){
$ SUserID = 1;
Include ("chtmain. php3 ");
Exit ();
}
Else {
$ ConnID = @ odbc_connect ("jtfcht", "admin ","");
If ($ ConnID ){
$ Result = @ odbc_exec ($ ConnID, "SELECT UserID, UserName, PassWord, RoomID, Sex FROM User WHERE UserName = '". $ sUserName ."'");
If (@ odbc_fetch_into ($ result, 0, & $ rArr )){
$ SUserID = $ rArr [0];
If ($ rArr [2] ==$ sPass ){
If ($ rArr [3] = 0 ){
@ Odbc_exec ($ ConnID, "UPDATE User SET RoomID = 1, LstDate = '". date ("Y. m. d "). "', ToID = 0, ToName = 'Everybody', Secret = False, FirstTime = True, LstTime = ". time (). "WHERE UserID = ". $ sUserID );
If ($ rArr [4])
@ Odbc_exec ($ ConnID, "insert into ChtCont (sIDFrom, sNameFrom, sipFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (". $ rArr [0]. ",'". $ rArr [1]. "','". getenv ("REMOTE_ADDR "). "', 0, 'Everybody ','". date ("H: I: s "). "',' Welcome to system message ". $ rArr [1]. "Come to this chat room ', False, 1 )");
Else
@ Odbc_exec ($ ConnID, "insert into ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (". $ rArr [0]. ",'". $ rArr [1]. "','". getenv ("REMOTE_ADDR "). "', 0, 'Everybody ','". date ("H: I: s "). "',' Welcome to system message ". $ rArr [1]. "Come to this chat room ', False, 1 )");
Include ("chtmain. php3 ");
Exit ();
}
Else $ sErrText = "logon error. someone has logged on with this name! ";
}
Else $ sErrText = "logon error, incorrect password! ";
}
Else $ sErrText = "logon error. user not registered! ";
@ Odbc_close ($ ConnID );
}
Else $ sErrText = "system fault, temporarily unable to log on ";
}
}
?>
Wintitle chat room