|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
可以说你的马步已经扎的差不多了,接下来就要开始练把势的时候了,如果有条件的话,用笔或者打印一个简易的PHP手册在身上,时不时的摸出来看看,记得,去WC也不能放过(^2^)。 lt1.php:
该法式为全部体系的进口,含有两个全局参数:chat_hh,uname分离纪录以后最大的讲话序号和讲话者称号
<?
session_start();
session_register("chat_hh");
session_register("uname");
//取数据库最大编号
include("g_fun.php");
f_connectdb();
$query = "select max(lt_id) as rmaxid from lt_t_content";
$res = mysql_query($query, $dbh);
$row = mysql_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;
//增添在耳目员信息
$query = "select count(*) as rcount from lt_t_online where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
$row = mysql_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_query($query, $dbh);
}
$query = "update lt_t_online set lt_lasttime = now(),lt_state = '0' ";
$query .= " where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
?>
<html>
<head>
<title>PHP无刷新感聊天室</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language=JavaScript>
function wu(){
var un="<?echo $name;?>";
this.f2.document.fyq.username.value=un;
this.f2.document.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" name="f2">
<frame src="about:blank" name="bforlt3">
</frameset>
<frameset rows='*,150' border=1 frameborder=1 framespacing=0>
<frame src='ltonline.php' name='f3' marginwidth=0 scrolling='auto'>
<frame src="about:blank" name='f4' marginwidth=0>
</frameset>
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
</body></noframes>
</html>
看到好的帖子最好up一下,以使得更多的人得到分享。 |
|