|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
讲了这么多,无非是想说:学习PHP不仅要掌握方法,更多的是付出汗水,我不希望看到中途放弃的人,相信自己,相信自己的选择,更要相信自己的能力,如果自己想放弃,暴力一点的话,就自己抽自己一个嘴巴。 (接后面局部)
<body leftmargin="0" topmargin="0">
<div align=center>
<br>
<form method="post" action="lt3.php" name="fyq" target="bforlt3" >
姓名: <input type="text" name="username" maxlength="10" >
说:<input type="text" name="saystemp" maxlength="200" size="50" >
<input type="submit" name="send" value="讲话" >
<br>
<input type=checkbox name='towhoway' value='1' >
<a href='#'
title="悄然话儿悄然说"><font color=black>私聊</font></a>
<select name='towho' style='font-size:12px' onClick=dj()>
<option value='人人' selected>人人</select>
举措:<select name='addsign' style='font-size:12px'>
<option value="0" selected>----</option>
<option value="//热忱地向在场的一切人打召唤。">召唤</option>
</select>
<input type=hidden name="fontsize" size=3>
<input type=hidden name="lineheight" size=3>
<input type=hidden name="oldtitleline" value="0">
<input type="button" value="清屏" style="background-color:FFFFFF;color:000000;border: 1 double">
<input accesskey="a" type="checkbox" name="as" checked >
<a href="#" >滚屏</a>
</form>
<script>
parent.wu();
write();
document.fyq.saystemp.focus();
</script>
</body>
</html>
lt3.php
处置讲话信息
<?
session_start();
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);
$maxid = $row["rmaxid"];
if (empty($maxid)) { $maxid = 0; }
$maxid = $maxid + 1;
//增添聊天信息
$query = "insert into lt_t_content(lt_id,lt_speaker,lt_speaked,lt_secrecy,lt_content,lt_time,lt_face)";
$query .= " values(".$maxid.",'".$username."','".$towho."','1','".$oldsays."',now(),'1')";
$res = mysql_query($query, $dbh);
//修正最初聊地利间,判别用户是不是存在,避免超时被删除
$query = "select count(*) as rcount from lt_t_online where lt_username = '".$username."'";
$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 .= "'".$username."',now())";
$res = mysql_query($query, $dbh);
}
$query = "update lt_t_online set lt_lasttime = now(),lt_state = '0' where lt_username = '".$username."'";
$res = mysql_query($query, $dbh);
//显示聊天纪录
$query = "select lt_id,lt_speaker,lt_face,lt_speaked,lt_time,lt_content from lt_t_content";
$query .= " where lt_id > ".$chat_hh. " order by lt_time desc";
$res = mysql_query($query, $dbh);
$chat_hh = $maxid;
$tempi = $maxid;
while ($row = mysql_fetch_array($res)) {
?>
<script Language=JavaScript1.1>
var zt="<? echo '0'; ?>";
var un="<?echo $row['lt_speaker'];?>";
var tw="<?echo $row['lt_speaked'];?>";
var sa="<?echo $row['lt_content'];?>";
parent.f2.nw(zt,un,tw,sa); //向显示处写入最新的数据.
</script>
<?
$tempi=$row['lt_id'];
}
if ($tempi > $chat_hh) {
$chat_hh = $tempi;
}
?>
PHP和HTML混合编程应该不成问题,在这期间,你完全可以让PHP给你算算 一加一等于几,然后在浏览器输出,不要觉得幼稚,这的确是跟阿波罗登月一样,你打的是一小段代码,但是对于你的编程之路,可是迈出了一大步啊!兴奋吧?但是不得不再给你泼点冷水,您还是菜鸟一个。 |
|