用PHP和ACCESS写聊天室,隐藏密码
分类:面向对象

请参考这个程序: ?php //$day 星期几,如:星期三 $day=3; ? html head meta "Content-Type" content="text/html; charset=gb2312" meta name="GENERATOR" content="Microsoft FrontPage 4.0" meta name="ProgId" content="FrontPage.Editor.Document" titletest/title /head body onload="window.form1.day.value=?php echo $day ; ?" FORM action="" method=POST id=form1 name=form1 SELECT id=day name=day size="1" option value="1"星期一/option option value="2"星期二/option option value="3"星期三/option option value="4"星期四/option option value="5"星期五/option option value="6"星期六/option option value="7"星期日/option /SELECT /FORM /body /html 触类旁通,利用 window_onload 可以很巧妙的实现一些默认项的选取。 希望对大家有所帮助。 请笑纳。

enterrm.php3 代码如下: ?php $ConnID=@odbc_connect(jtfcht,admin,); if ($ConnID){ $result=@odbc_exec($ConnID,SELECT PassWord,LstTime,RoomID,RefRate FROM User WHERE UserID=.$id); if (@odbc_fetch_into($result,0,&$rArr)){ $sRoomID=$rArr[2]; $sRefRate=(int)$rArr[3]; if ($sRefRate2) $sRefRate=2; if (($rArr[0]==$ps) && ($rArr[1]=(time()-1800))){ $sNewRoomID=substr($selRoom,2); if ($sNewRoomID!=$sRoomID){ $result=@odbc_exec($ConnID,SELECT Password FROM Room WHERE RoomID=.$sNewRoomID); if (@odbc_fetch_into($result,0,&$rArr)){ if ((strlen(trim($rArr[0]))==0) || ($rArr[0]==$sPass)){ @odbc_exec($ConnID,UPDATE User SET RoomID=.$sNewRoomID.,ToID=0,ToName='大家' WHERE UserID=.$id); if ((int)$sRoomID!=1){ $result=@odbc_exec($ConnID,SELECT COUNT(UserID) FROM User WHERE RoomID=.$sRoomID); @odbc_fetch_into($result,0,&$rArr); if ($rArr[0]==0) @odbc_exec($ConnID,DELETE * FROM Room Where RoomID=.$sRoomID); } } else{ ? html head title输入房间口令/title meta content=text/html; charset=gb2312 link rel=stylesheet href=main.css type=text/css script language=JavaScript !-- function PassSetFocus( ) { document.frmEnterSm.sPass.focus(); } //-- /script link rel=stylesheet href=main.css type=text/css /head body onload=PassSetFocus(); p/p p align=centerfont color=#996666输入房间口令/font/p form name=frmEnterSm action=enterrm.php3 method=post table width=100% border=0 align=center tr td colspan=2input type=hidden name=selRoom value=?php echo $selRoom; ?input type=hidden name=id value=?php echo $id; ?input type=hidden name=ps value=?php echo $ps; ?/td /tr tr td width=40% align=right口令:/td td width=60%input type=password name=sPass maxlength=10 size=8/td /tr tr td colspan=2 align=centerinput type=submit name=cmdYes value=进入/td /tr /table /form p align=center按a href=room.php3?id=?php echo $id; ?&ps=?php echo $ps; ?&at=?php echo time(); ?这里/a放弃/p /body /html ?php exit(); } } else{ ? html head title加入房间出错/title meta content=text/html; charset=gb2312 link rel=stylesheet href=main.css type=text/css /head body p/p p align=center这个房间已经被拆了!/p p align=center按a href=room.php3?id=?php echo $id; ?&ps=?php echo $ps; ?&at=?php echo time(); ?这里/a返回/p /body /html ?php exit(); } } } else echo htmlheadmeta 'Content-Type' content='text/html; charset=gb2312'title房间/titlelink rel='stylesheet' href='main.css' type='text/css'/headbody/body/html; } else echo htmlheadmeta 'Content-Type' content='text/html; charset=gb2312'title房间/titlelink rel='stylesheet' href='main.css' type='text/css'/headbody/body/html; @odbc_close($ConnID); } else echo htmlheadmeta 'Content-Type' content='text/html; charset=gb2312'title房间/titlelink rel='stylesheet' href='main.css' type='text/css'/headbody/body/html; include(room.php3); ?

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>显示、隐藏密码-www.51windows.Net</title>
<style>
body,input{font:menu}
</style>
</head>
<body>
<form method="POST" action="addcheck.asp" name="forms">
<span id=box><input type="password" name="password" size="20" value="51windows.com"></span>
<span id=click><a href="javascript:ps()">显示密码</a></span>
<script language="JavaScript">
<!--51windows.com:海娃 23:17 2002-8-17-->
function ps(){
if (this.forms.password.type="password")
box.innerHTML="<input type="html" name="password" size="20" value="+this.forms.password.value+">";
click.innerHTML="<a href="javascript:txt()">隐藏密码</a>"}
function txt(){
if (this.forms.password.type="text")
box.innerHTML="<input type="password" name="password" size="20" value="+this.forms.password.value+">";
click.innerHTML="<a href="javascript:ps()">显示密码</a>"}
</script></form>
<script>
function help(){
title="显示、隐藏密码"
time="23:17 2002-8-17"
tips="显示、隐藏input中的密码,动态改为input的type值。在提示注册时就不用来两个输入框了:)"
info="nwww.51windows.comn海娃:[email protected]"
alert(title+"n("+time+")nn"+tips+"nn"+info)}
document.write("<button style='font:menu;position: absolute; top: 20; right: 10;' onclick=help();>Help</button >");
document.write("<button style='font:menu;position: absolute; top: 20; right: 50;' onclick=window.location='view-source:'+window.location.href;>源文件</button >")
</script>
</body>
</html>

head meta http-equiv="Content-Type" content="text/html; charset=gb2312" meta name="GENERATOR" content="Microsoft FrontPage 4.0" meta name="ProgId" content="FrontPage.Editor.Doc...

本文由10bet手机官网发布于面向对象,转载请注明出处:用PHP和ACCESS写聊天室,隐藏密码

上一篇:常用优化工具,诊断及定位问题根源 下一篇:没有了
猜你喜欢
热门排行
精彩图文