Use PHP and ACCESS to write chat rooms (1)

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.