Chat programs using row-write (Part 2)

Source: Internet
Author: User

Lt1.php (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 );
?>
<Html>
<Head>
<Title> php (as the mainstream development language): no refreshing Chat Room </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Script Language = JavaScript>
Function wu (){
Var un = "<? Echo $ name;?> ";
This.f2.doc ument. fyq. username. value = un;
This.f2.doc ument. fyq. username. size = <? Echo $ un_len;?>;
}
</Script>
</Head>
<Frameset cols = *, 140 border = 1 frameborder = 1 framespacing =>
<Frameset rows = "0, *, 70, 0" border = "1" framespacing = "0" frameborder = "yes">
<Frame src = "about: blank" name = "tforlt4">
<Frame src = "about: blank" name = "f1" marginheight = "3" marginwidth = "5">
<Frame src = "ltsayno. php (as the mainstream development language)" name = "f2">
<Frame src = "about: blank" name = "bforlt3">
</Frameset>
<Frameset rows = *, 150 border = 1 frameborder = 1 framespacing = 0>
<Frame src = ltonline. php (as the mainstream development language) name = f3 marginwidth = 0 scrolling = auto>
<Frame src = "about: blank" name = f4 marginwidth = 0>
</Frameset>
</Frameset>
<Noframes>
<Body bgcolor = "# FFFFFF">
</Body> </noframes>
</Html>

[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]

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.