澳门新葡亰娱乐官网一个简易需要注册的留言版程序

世家好!好久未有观看大家了,上次写了用PHP的通过文件操作的聊天室,当然是漏洞非常多的,况兼每贰遍刷新荧屏都特不好的!小编想了深切,是不是能有一种方式毫无刷新,就会博得发言的新闻了?多用一个框架就能够完成那一个职能了,即多用三个框架大家誉为getmsg,大家让getmeg去赢得消息同一时间保障每二遍拿走的新闻是最新的,正是上次获得的解说就不用了,上次笔者编的就是每贰次取得音信都以再一次的,那样效果倒霉。
笔者的安顿观念是:每三遍发言,都把它交给到服务器上,然后保留到二个数据Curry,每格几分钟getmsg就去服务器上收获
最新发言数据,并保管上次到手的演讲就无须取下来了,然后把取下来的发言叠合到一个特意展现发言的窗口(listmsgState of Qatar去。那样我们就认为listmsg窗口不会有重刷新的以为到何况,只是见到发言新闻不断加进去,那样就有很好的作用,
怎么样在一个框架把音信加到另个框架去了?用JavaScript就能够达成这几个主张的:
script language=JavaScript !– var win=parent.frames[0]
//第叁个框架即在文书档案中第一遍现身的frame var doc=win.document //获取文档doc.write(发言新闻State of Qatar//那样就足以把音信加到另个frame里去了! — /script
当然你得在mysql里建七个表,一个表用于保存发言音信,三个表用于保存多少个在线的,在列在窥伺者数时,大家让它每一个60秒刷新一回,并把一分钟早先的演说删掉,并看有些发言人是否十分短日子没发言了,是的话,就删掉他,
由于表的子段不会细小略,在那间就不要写出来了,看程序就能够知道了。这几个程序在网络网下测量试验的效用都很好!
表的名字是:chat和chat_getmsg !–主框架chat.php– ?PHP
if(!isset($username))$username=guest;
$conid=mysql_connect(localhost,yourcounter,password);
mysql_select_db(yourdadabase,$conid); $dstr=date(YmdHis); $sql=insert
chat_getmsg (username,shijian) values (‘$username’,’$dstr’);
mysql_query($sql,$conid); $sql=update chat_getmsg set shijian=’$dstr’
where username=’$username’; mysql_query($sql,$conid);
mysql_close($conid); ? html head titleUntitled Document/title meta
content=text/html; charset=gb2312 /head frameset rows=283,105
frameborder=YES border=1 framespacing=0 cols=*frameset cols=520,113
frameborder=yes border=1 framespacing=0 rows=*frame name=topFrame
scrolling=auto border=1 noresize src=list.html frame name=rightFrame
scrolling=auto border=1 noresize src=username.php /frameset frameset
rows=17,90 frameborder=yes border=1 framespacing=0 cols=*?PHP echo
frame name=topFrame1 scrolling=NO border=1 noresize
src=getmsg1.php?username=$usernamen; ? ?PHP echo frame name=bottomFrame
scrolling=NO border=1 noresize src=fayan.php?username=$usernamen; ?
/frameset /frameset noframesbody bgcolor=#FFFFFF /body/noframes /html
!–发言fayan.php — ?php if(!isset($username)) $username=guest;
if(!isset($yanse)) $yanse=blue; if(!isset($objectname))
$objectname=大家; ? html head titleUntitled Document/title meta
content=text/html; charset=gb2312 style type=text/css !– .normalfont
{font-family: 宋体; font-size: 10pt; font-weight: 800; color: #99FF33;
height: auto; width: auto; left: 0px; top: 0px; clip:rect()} — /style
/head body bgcolor=#ff3333 form method=post name=fayanform action=?PHP
echo fayan.php?username=$username&yanse=$yanse&objectname=$objectname ;?
class=normalfont table width=100% border=0 cellspacing=0 cellpadding=0
class=normalfont trtd width=17%height=22 颜色:select id=yanse name=yanse
option value=blue ?PHP if($yanse==blue) echo SELECTED;? Blueoption
value=red?PHP if($yanse==red) echo SELECTED;? red option value=green
?PHP if($yanse==green) echo SELECTED;?green option value=yellow ?PHP
if($yanse==yellow) echo SELECTED;? yellow option value=brown ?PHP
if($yanse==brown) echo SELECTED;? brown option value=#ff00ff ?PHP
if($yanse==#ff00ff) echo SELECTED;? ff00ff option value=#bb00ff ?PHP
if($yanse==#bb00ff) echo SELECTED;? bb00ff option value=#cc00ff ?PHP
if($yanse==#cc00ff) echo SELECTED;? cc00ff option value=#aa00ff ?PHP
if($yanse==#aa00ff) echo SELECTED;? aa00ff option value=#澳门新葡亰娱乐官网,6600ff ?PHP
if($yanse==#6600ff) echo SELECTED;? 6600ff option value=#7700ff ?PHP
if($yanse==#7700ff) echo SELECTED;? 7700ff option value=#1100ff ?PHP
if($yanse==#1100ff) echo SELECTED;? 1100ff option value=#11ffff ?PHP
if($yanse==#11ffff) echo SELECTED;? 11ffff option value=#11aaff ?PHP
if($yanse==#11aaff) echo SELECTED;? 11aaff option value=#1199ff ?PHP
if($yanse==#1199ff) echo SELECTED;? 1199ff option value=#1133ff ?PHP
if($yanse==#1133ff) echo SELECTED;? 1133ff /select /td td
width=55%height=22 class=normalfont发言:input type=text name=fayan
size=35 input type=hidden name=username value=?PHP echo $username; ?
input type=Button name=Button value=发言 onclick=submitfayan() /td td
width=28%height=22 /td /tr trtd width=17% height=20对象: input type=text
name=objectname size=10 value=?PHP echo $objectname;? /td td
width=55%height=20 class=normalfonta href=回去/a /td td width=28%
height=20 class=normalfont /td /tr /table /form /body Script
language=JavaScript !– fayanform.fayan.focus() function submitfayan() {
if(fayanform.fayan.value!=卡塔尔 fayanform.submit(State of Qatar else alert(无法发空音讯卡塔尔fayanform.fayan.focus(卡塔尔国 } — /script /html ?PHP
if(isset($username卡塔尔国&&isset($fayan卡塔尔State of Qatar{
$conid=mysql_connect(localhost,yourcount,yourpassword);
mysql_select_db(database,$conid); $sql=insert chat
(username,objectname,action,msg,color) values
($username,$objectname,NO,$fayan,$yanse); mysql_query($sql,$conid);
mysql_close($conid); } ? !–获取发言消息getmsg.php– html head
titleUntitled Document/title meta content=text/html; charset=gb2312
?PHP$conid=mysql_pconnect(localhost,yourcount,password);
mysql_select_db(database,$conid); if(!isset($username))
$username=getmsg;$dt=time();$newdate=date(YmdHis,$dt);
$fromdate=date(YmdHis,$dt-6);; $sql=select username as
name,msg,action,objectname ,shijian,color from chat where
shijian=$fromdate; $res=mysql_query($sql,$conid); echo meta
content=6,url=getmsg.php?username=$username n; echo /headn; echo script
language=JavaScriptn; echo !–n; echo var win=parent.frames[0]n; echo
var doc=win.documentn; echo var divlin=doc.body.all(lin)n;
while(list($name,$msg,$action,$objectname,$shijian,$color)=mysql_fetch_row($res))
{ if($objectname!=大家||$objectname) $object=对 a
href=JavaScript:selectusername(‘$objectname’)$objectname/a ;
echodivlin.innerHTML=divlin.innerHTML+font color=$color size=3a
href=JavaScript:selectusername(‘$name’)$name/a $object 说: $msg
/fontbrn; } echo win.scrollBy(6000,6000)n; echo –n; echo /scriptn; ?
body bgcolor=#333333 /body /html !–欢迎词getmsg1.php — html head
titleUntitled Document/title meta content=text/html; charset=gb2312
?PHPif(!isset($username)) $username=guest; echo meta
content=6;url=getmsg.php?username=$username n; echo /headn; echo script
language=JavaScriptn; echo !–hiden; echo var win=parent.frames[0]n;
echo var doc=win.documentn; echo var divlin=doc.body.all(lin)n; echo
divlin.innerHTML= font color=blueb欢迎 $username 的光临/b/fontbrn; echo
–n; echo /scriptn; ? body bgcolor=#333333 /body /html
!–展现发言list.html– html head titleUntitled Document/title meta
content=text/html; charset=gb2312 style type=text/css !– .lin
{font-size: 10pt; color: #FF6633} — /style /head body bgcolor=#FFFFFF
center div color=blue font color=white size=6b 招待光顾/b /marquee /div
/center div id=lin class=lin/div /body Script language=JavaScript !–
function selectusername(str) { var win=parent.frames[3] var
doc=win.document var form1=doc.body.all(fayanform)
form1.objectname.value=str } — /script /html !–罗列在线人数– html
head titleUntitled Document/title meta content=text/html; charset=gb2312
meta content=60 style type=text/css !– .lin {font-size: 10pt; color:
#ff0066} — /style /head body bgcolor=#33ff00 center class=linb
在线人数 /b hr ?PHP if(!isset($username)) $username=guest;
$dt=time();$newdate=date(YmdHis,$dt); $fromdate=date(YmdHis,$dt-200);
$linkid=mysql_connect(localhost,yourcount,password);
mysql_select_db(yourdatabase,$linkid); $sql=update chat_getmsg set
shijian=$newdate where username=$username; mysql_query($sql,$linkid);
$sql=select username from chat_getmsg where shijian=$fromdate;
$res=mysql_query($sql,$linkid);
while(list($username)=mysql_fetch_row($res)){ echo a
href=JavaScript:selectusername(‘$username’)$username/abrn;
$fromdate=date(YmdHis,$dt-100); $sql=delete from chat where
shijian=$fromdate; mysql_query($sql,$linkid); mysql_close($linkid); }
? /center Script language=JavaScript !– function selectusername(str) {
var win=parent.frames[3] var doc=win.document var
form1=doc.body.all(fayanform) form1.objectname.value=str } — /script
/body /html

1.guestbook.php html head script language=JavaScript !– !– var
hellotext=为了您的精品浏览效果请你使用IE4.0以上的版本和800*600分辨率
var thetext= var started=false var step=0 var times=1 function
welcometext() { times– if (times==0) { if (started==false) { started =
true; window.status = hellotext; setTimeout(anim(),1); } thetext =
hellotext; } } function showstatustext(txt) { thetext = txt;
setTimeout(welcometext(),4000) times++ } function anim() { step++ if
(step==7) {step=1} if (step==1) {window.status=’===’+thetext+’===’} if
(step==2) {window.status=’===’+thetext+’===’} if (step==3)
{window.status=’==’+thetext+’==’} if (step==4)
{window.status=’==’+thetext+’==’} if (step==5)
{window.status=’===’+thetext+’===’} if (step==6)
{window.status=’===’+thetext+’===’} setTimeout(anim(),200); } // —
welcometext(); function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+.location=’+selObj.options[selObj.selectedIndex].value+’卡塔尔(قطر‎;
if (restoreState of Qatar selObj.selectedIndex=0; } //– /script
title天地互联网留言版/title meta content=text/html; charset=gb2312 /head
style type=text/css !– a:link {font-size: 9pt; color: #FFFFFF} —
/style body ? $PAGESIZE=5; $db=mysql_connect(localhost,root,);
mysql_select_db(lyanban,$db); $result=mysql_query(SELECT * FROM
message order by date desc,$db); $rowcount=mysql_num_rows($result卡塔尔(قطر‎;
$PAGES=CEIL($rowcount/$PAGESIZEState of Qatar; if($rowcount==0卡塔尔国 {echo 近期未有留言!a
href=guestbook.htm接待您留言!/a;} if($rownum == 卡塔尔国 { $rownum = 1; }
$AA=CEIL($rownum/5卡塔尔(قطر‎; $i=0 ; echo TABLE WIDTH=百分百tddiv font size=2
color=#000000B共有留言:$rowcount 条共:$PAGES 页right以往是第 $AA
页/right/B/font/div/td; echo hr size=1 color=#ccccffwidth=75%; while
($myrow=mysql_fetch_array($result)){ $i++;
if(($i=$rownum)&&($i$rownum+5)){ echo table width=75% border=1
cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF
bordercolorlight=#000000 background=15.JPG; echo trtd width=15%div font
size=2 color=#FFFFFF姓 名/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[username]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF电子信箱/font/div/tdtd width=85%font size=2
color=#FFFFFFa href=mailto:$myrow[email]$myrow[email]/font/a/td/tr;
echo trtd width=15%div font size=2 color=#FFFFFF集团主页/font/div/tdtd
width=85%font size=2 color=#FFFFFFa href=$myrow[homepage]
target=_blank$myrow[homepage]/font/a/td/tr; echo trtd width=15%div
font size=2 color=#FFFFFF留言核心/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[topic]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言内容/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[content]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言时间/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[date]/font/td/tr; echo /tablehr size=1
color=#ccccffwidth=75%;} } echo table width=100%trtd width=87%;
#判别是或不是有或 echo form name=hiddenform method=post
action=guestbook.php; echo div input type=hidden name=rownum value=;
echo input type=hidden name=rowcount value=$rowcount; #显示 if
($rownum=5) echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum-5).; #显示 if
($rownum+5=$rowcount) { echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum+5)./div; } echo
/form; echo /td; echo /tr; echo /table; echo table width=100% trtddiv
font color=#ffffff size=2a
href=guestbook.htm回去继续发言/a/font/div/td/tr/table; ? /body /html
2.show.php3 ? $username = htmlspecialchars(ltrim(stripslashes
(trim($nameState of Qatar卡塔尔(قطر‎卡塔尔(قطر‎卡塔尔;//本函式可去掉字串中的反斜线空格字元 $email =
htmlspecialchars(ltrim(stripslashes (trim($email卡塔尔国卡塔尔卡塔尔卡塔尔; $homepage =
htmlspecialchars(ltrim(stripslashes (trim($homepage卡塔尔国卡塔尔(قطر‎State of Qatar卡塔尔国; $topic =
htmlspecialchars(ltrim(stripslashes (trim($topic卡塔尔卡塔尔国卡塔尔卡塔尔(قطر‎; $content =
htmlspecialchars(ltrim(stripslashes (trim($content卡塔尔(قطر‎卡塔尔国State of Qatar卡塔尔(قطر‎; //
$content=base64_encode($content卡塔尔; //send email //if ($ok)mail($email,$topic,$content卡塔尔(قطر‎; if
(($username==State of Qataror($topic==卡塔尔(قطر‎or(strlen($usernameState of Qatar20State of Qataror(strlen($topic卡塔尔20卡塔尔(قطر‎卡塔尔国{echo 请填入必要的品种或着违法顾客名!a
href=javascript:history.go(-1State of Qatar;重返/a; } //wrong email ? elseif
(($email!=)and(!eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$emailState of Qatar卡塔尔卡塔尔(قطر‎{ echo 请您填写精确的 E-Mail 地址/pp a
href=javascript:history.go(-1State of Qatar;重临/a; } //wrong homepage ? elseif
(($homepage!=)and(!eregi(()+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$,$homepage卡塔尔国State of Qatar){echo 主页地址输入错误!a href=javascript:history.go(-1卡塔尔(قطر‎;再次来到/a;} else{
//联接数据库 mysql_connect(localhost,root,);
mysql_select_db(lyanban); $sql=select password from tb where
username=’$username’; $result=mysql_query($sql);
$nums=mysql_num_rows($result); if($nums!=1卡塔尔(قطر‎{ echo对不起!请先a
href=register.html注册/a!; } else{ //获得日期 YYYY-MM-DD HH:MM:SS
二零零四-01-01 00:00:00′ $t = date(Y.-.m.-.d. .H.:.i.:.s卡塔尔(قطر‎;
//将新客户插入数据库 mysql_query(insert into message values
(‘$username’,’$email’,’$homepage’,’$topic’,’$content’,’$t’)); echo div
font size=2 color=#000000感激你留言!您的留言已成功步向,a
href=guestbook.php再次回到/a/font/div; } } ? 3.zhuc.php(注册程序卡塔尔 ?
mysql_connect(localhost,root,卡塔尔国 or die(无法连接数据库,请重试State of Qatar;
mysql_select_db(lyanban卡塔尔(قطر‎ or die(不能够取舍数据库,请重试卡塔尔国; $query=select
password from tb where username=’$username’;
$result=mysql_query($query); $numrows=mysql_num_rows($result);
if($numrows!=0State of Qatar {echo ‘原来就有人注册此名,请重新接纳名字!a
href=javascript:history.go(-1);返回/a’;} else {$query=insert into
tb(username,password) values(‘$username’,’$password’);
mysql_query($query卡塔尔(قطر‎; echo ‘注册成功’; echo ‘A HREF=guestbook.htm
请登陆!/A’;} ? 以下是八个配套的HTML: 1。留言网页 html head meta
content=text/html; charset=gb2312 meta name=GENERATO奔驰G级 content=Microsoft
FrontPage 4.0 meta name=ProgId content=FrontPage.Editor.Document
title天地网络留言版接待您留言!/title /head body bgcolor=#FFFFFF div
align=center center br font size=2天地互连网留言版测量试验版/fontbr br form
method=post action=show.php3 table width=66% tr td width=二分之一 height=1
div align=center font size=2 您的高姓大名:/font/div /td td width=二分之一height=1 div align=center input type=text name=name size=20 /div /td /tr
tr td width=十分之五 height=1 div align=centerfont size=2
您的电子邮件地址:/font/div /td td width=百分之五十 height=1 div align=center
input type=text name=email size=20 /div /td /tr tr td width=一半 height=1
div align=centerfont size=2 您的营业所主页地址:/font/div /td td width=八分之四height=1 div align=center input type=text name=homepage size=20 value=
/div /td /tr tr td width=50% height=1 div align=center font
size=2留言焦点:/font/div /td td width=一半 height=1 valign=middle div
align=center input type=text name=topic size=20 /div /td /tr tr td
width=二分之一 height=1 div align=center font size=2留言情节:/font/div /td
td width=一半 height=1 div align=center /div /td /tr tr td width=100%colspan=2 height=66 p align=center textarea rows=10 name=content
cols=50/textarea /p /td /tr tr td width=一半 height=18 div
align=center/div /td td width=五成 height=18 div align=center/div /td /tr
tr td width=四分之二 height=18 align=center p align=center input type=submit
value=宣布留言 name=B1 /p /td td width=十分之五 height=18 align=center div
align=center input type=reset value=全体重写 name=B2 /div /td /tr /table
/form /center /div p /p p /p /body /html 2.注册程序 html head
titleregiste/title meta content=text/html; charset=gb2312 /head body
bgcolor=#FFFFFF div align=center p/p p/p p客户注册/p form method=post
action=zhuc.php p客商名: input type=text name=username /p p密码: input
type=password name=password /p p input type=submit name=Submit
value=明确 input type=reset name=Submit2 value=重来 /p /form p/p /div
/body /html 如必要ZIP文件可给自家写信。tandinet@163.net

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图