Use PHP and ACCESS to write chat rooms (1)

Source: Internet
Author: User
The INDEX. PHP code is as follows! & Lt ;? Php (as the mainstream development language) functiondelquot (& #36; sStr) & #123; & nbsp; & #36; sstr_replace (chr (124), & #36; sStr); & nbsp; & #36; s 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. php (as the mainstream development language) 3 ");
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 "). ", [system message] welcome ". $ 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 "). ", [system message] welcome ". $ rArr [1]. "Come to this chat room, False, 1 )");

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.