Chat programs using row-write (part 2)

Source: Internet
Author: User
Tags php database
Lt1.php (as the mainstream development language): This program is the portal of the entire system. It contains two global parameters: chat_hh. the uname records the maximum number of speakers and the name of the Speaker respectively. & lt ;? Session_start (); session_register (chat_hh); session_register (uname); // obtain the largest lt1.php database (as the mainstream development language ):
This program is the entrance of the entire system, containing two global parameters: chat_hh, uname, respectively, recording the current maximum number of speakers and the speaker name

Session_start ();
Session_register ("chat_hh ");
Session_register ("uname ");


// Obtain the maximum number of a database
Include ("g_fun.php (as the mainstream development language )");
F_connectdb ();
$ Query = "select max (lt_id) as rmaxid from lt_t_content ";
$ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
$ Row = MySQL (the best combination with PHP) _ fetch_array ($ res );
$ F_chat_hh = $ row ["rmaxid"];
If (empty ($ f_chat_hh) {$ f_chat_hh = 0 ;}
If ($ f_chat_hh> 12 ){
$ Chat_hh = $ f_chat_hh-12;
} Else
$ Chat_hh = $ f_chat_hh;

$ Un_len = strlen ($ name );
$ Uname = $ name;

// Add online personnel information
$ Query = "select count (*) as rcount from lt_t_online where lt_username =". $ name ."";
$ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
$ Row = MySQL (the best combination with PHP) _ fetch_array ($ res );
$ Lcount = $ row ["rcount"];
If ($ lcount = 0 ){
$ Query = "insert into lt_t_online (lt_username, lt_lasttime) values (";
$ Query. = "". $ name. ", now ())";
$ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
}
$ Query = "update lt_t_online set lt_lasttime = now (), lt_state = 0 ";
$ Query. = "where lt_username =". $ name ."";
$ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
?>


Php (as the mainstream development language) does not refresh the 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.