gusucode.com > ASP+ACCESS中学网站设计与实现(论文+源代码+开题报告+任务书) > ASP+ACCESS中学网站设计与实现(论文+源代码+开题报告+任务书)\ASP001中学网站设计与实现\zxweb\lyb\write.asp
<%@ language=VBScript %> <!--#include file="setup.asp"--> <!--#include file="inc/check.asp"--> <% sql="select * from gbook where idlock=0 order by id desc" set Rs = Server.CreateObject("ADODB.Recordset") Rs.open sql,conn,1,1 if Request("menu") = "addto" then call addto() else call index() end if sub index() %> <html><head><title>添加留言</title> <link rel="stylesheet" href="images/gbook.css"> </head> <!--#include file="inctop.asp"--><body topmargin=0> <div align="center"><img src="./images/logo.jpg" width="759" height="110"> </div> <table width=760 height="27" border=0 align="center" cellpadding=0 cellspacing=1 background="images/dh.gif" style="border: 1px solid #CCCCCC;"> <tr> <td width="510" height="27"> <img src="images/arrow3.gif" align=absmiddle width="29" height="11"> 您的位置: <a href="../index.htm"><font color="#FF3300"><b>江苏省铁富高级中学</b></font></a> >> <a href=index.asp>留言本首页</a> >> <a href=index.asp>浏览留言</a> >> <a href=index.asp></a>发表留言</td> <td width="245"><DIV align=center>【<a href="index.asp">查看留言</a>】 【<a href="write.asp">签写留言</a>】</DIV></td> </tr> </table> <br> <script language="JavaScript1.2"> <!-- clckcnt = 0; var postmaxchars = <%=bodymax%>; function clckcntr(eventobject){if(event.ctrlKey && window.event.keyCode==13){clckcnt++;if (clckcnt>1) {alert('留言正在提交,请耐心等待!');return false;}document.FORM.Submit.disabled = true; this.document.FORM.submit();}} function validate(theform) { if (theform.username.value=="" || theform.body.value=="" ||theform.zt.value=="") { alert("'姓名' 和 '留言主题' 和 '留言内容' 是必须填写的!"); clckcnt=0; return false; } if (postmaxchars != 0) { if (theform.body.value.length > <%=bodymax%>) { alert("你的信息太长了.\n\n请限制在 "+<%=bodymax%>+" 字节以内.\n当前已有 "+theform.body.value.length+" 字节."); clckcnt=0; return false; } else { document.FORM.Submit.disabled = true; return true; } } else { document.FORM.Submit.disabled = true; return true; } } function checklength(theform) { if (postmaxchars != 0) { message = "\n最大的字符为 "+<%=bodymax%>+" 字节."; } else { message = ""; } alert("你的信息已经有 "+theform.body.value.length+" 字节."+message); } --> </script> <table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="180" height="99" bgcolor="#FFFFF0" style="border: 1px solid #CCCCCC;"> <!--#include file="guest_left.asp"--></td> <td width="10" bgcolor="#FFFFFF"> </td> <td width="570" valign="top"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFF0"> <tr> <td width="570" height="305" bgcolor="#999999"> <form name="FORM" method="POST" action="write.asp" onSubmit="return validate(this)"> <%session("OldGuestSave")=""%> <input type=hidden name=menu value=addto> <input type=hidden name=ip value=<%=Request.ServerVariables("REMOTE_ADDR")%>> <table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC"> <tr bgcolor="#ebebeb"> <td width="18%" align="center" nowrap bgcolor="#FFFFF0"><font color="#FF0000">*</font>你的大名:</td> <td width="82%" bgcolor="#FFFFF0"> <input type="text" name="username" size="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''"> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" align="center" nowrap bgcolor="#FFFFF0"><font color="#FF0000">*</font>留言主题:</td> <td width="100%" bgcolor="#FFFFF0"> <input name="zt" type="text" id="zt" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''" size="50"> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" align="center" nowrap bgcolor="#FFFFF0"><font color="#FF0000">*</font>留言内容:</td> <td width="82%" bgcolor="#FFFFF0"> <textarea name="body" onkeydown=clckcntr(); cols="60" rows="6" wrap=hard style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''"><%=Request.QueryString("body")%></textarea> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" height="12" align="center" nowrap bgcolor="#FFFFF0">你的主页:</td> <td width="82%" height="12" bgcolor="#FFFFF0"> <input type="text" name="homeurl" size="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''" value="http://"> <a href="javascript:checklength(document.FORM);">[查看帖子长度]</a> </td> </tr> <tr bgcolor="#ebebeb"> <td align="center" nowrap bgcolor="#FFFFF0">你的邮件:</td> <td width="82%" bgcolor="#FFFFF0"> <input type="text" name="email" size="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''"> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" align="center" nowrap bgcolor="#FFFFF0">你的OICQ:</td> <td width="82%" bgcolor="#FFFFF0"> <input type="text" name="qq" size="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#F7FBFF'" onMouseOut = "this.style.backgroundColor = ''"> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" height="12" align="center" nowrap bgcolor="#FFFFF0">您的表情:</td> <td width="82%" height="12" bgcolor="#FFFFF0"> <input name="brow" type="radio" value="images/brow/1.gif" checked> <img src="images/brow/1.gif"> <input type="radio" value="images/brow/2.gif" name="brow"> <img src="images/brow/2.gif"> <input type="radio" value="images/brow/3.gif" name="brow"> <img src="images/brow/3.gif"> <input type="radio" value="images/brow/4.gif" name="brow"> <img src="images/brow/4.gif"> <input type="radio" value="images/brow/5.gif" name="brow"> <img src="images/brow/5.gif"> <input type="radio" value="images/brow/6.gif" name="brow"> <img src="images/brow/6.gif"> <input type="radio" value="images/brow/7.gif" name="brow"> <img src="images/brow/7.gif"> <input type="radio" value="images/brow/8.gif" name="brow"> <img src="images/brow/8.gif"> <br> <input type="radio" value="images/brow/9.gif" name="brow"> <img src="images/brow/9.gif"> <input type="radio" value="images/brow/10.gif" name="brow"> <img src="images/brow/10.gif"> <input type="radio" value="images/brow/11.gif" name="brow"> <img src="images/brow/11.gif"> <input type="radio" value="images/brow/12.gif" name="brow"> <img src="images/brow/12.gif"> <input type="radio" value="images/brow/13.gif" name="brow"> <img src="images/brow/13.gif"> <input type="radio" value="images/brow/14.gif" name="brow"> <img src="images/brow/14.gif"> <input type="radio" value="images/brow/15.gif" name="brow"> <img src="images/brow/15.gif"> <input type="radio" value="images/brow/18.gif" name="brow"> <img src="images/brow/18.gif"> <br> </td> </tr> <tr bgcolor="#ebebeb"> <td width="18%" height="2" align="center" nowrap bgcolor="#FFFFF0">选择头像:</td> <td width="82%" height="2" nowrap bgcolor="#FFFFF0"> <input name="face" type="radio" value="images/face/1.gif" checked> <img src="images/face/1.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/2.gif"> <img src="images/face/2.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/3.gif"> <img src="images/face/3.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/4.gif"> <img src="images/face/4.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/5.gif"> <img src="images/face/5.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/6.gif"> <img src="images/face/6.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/7.gif"> <img src="images/face/7.gif" width="32" height="32"><br> <input type="radio" name="face" value="images/face/8.gif"> <img src="images/face/8.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/9.gif"> <img src="images/face/9.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/10.gif"> <img src="images/face/10.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/11.gif"> <img src="images/face/11.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/12.gif"> <img src="images/face/12.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/13.gif"> <img src="images/face/13.gif" width="32" height="32"> <input type="radio" name="face" value="images/face/14.gif"> <img src="images/face/14.gif" width="32" height="32"> </td> </tr> <tr bgcolor="#FFFFF0"> <td colspan="2" align="center" nowrap> <input type="submit" name="Submit" value="发表留言" onclick="return clckcntr();" style="backgroud-color: #ffffff; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; border-top: 1px solid; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; HEIGHT: 18px; WIDTH: 50px"> <input type="reset" name="Submit2" value="重写留言" style="backgroud-color: #ffffff; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; border-top: 1px solid; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; HEIGHT: 18px; WIDTH: 50px"> <input type="button" name="Submit3" value="取消留言" onClick="javascript:history.back(-1);" style="backgroud-color: #ffffff; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; border-top: 1px solid; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; HEIGHT: 18px; WIDTH: 50px"> </td> </tr></form> </table> </td> </tr> </table></table> <table width=760 height="22" border=0 align="center" cellpadding=0 cellspacing=1 background="images/dh.gif" style="border: 1px solid #CCCCCC;"> <tr> <td width="510" height="18"> </td> <td width="245"> </td> </tr> </table> <% call htmlend() Response.End end sub sub addto() dim username, email, homeurl, qq, body, addtime, sql, Rs, ip, face, brow username=htmlencode2(trim(Request.form("username"))) zt=htmlencode2(trim(Request.form("zt"))) email=htmlencode2(trim(Request.form("email"))) homeurl=htmlencode2(trim(Request.form("homeurl"))) qq=htmlencode2(trim(Request.form("qq"))) body=htmlencode2(Request.form("body")) face=Request.form("face") ip=Request.ServerVariables("REMOTE_ADDR") brow=Request.form("brow") if session("OldGuestSave") <> "" then message1="请不要重复提交同一条信息嘛!\n" end if if username = "" then message="请填写您的名字哦!\n" end if if zt = "" then message="请填写留言主题!\n" end if if email <> "" and IsValidEmail(email)=false then message=message&"您的电子邮件是不是错了?\n" end if if qq <> "" and isInteger(qq) = false then message=message&"对不起,您所填写的 QQ 号码不是数字哦,这样是不行的!\n" end if if qq <> "" and len(qq) < 4 then message=message&"好像没有小于4位号码的QQ吧?\n" end if if qq <> "" and len(qq) > 11 then message=message&"好像还没有超过11位号码的QQ吧!\n" end if if qq = "" then qq="不告诉你" end if if body = "" then message=message&"留言内容不能为空!\n" end if if face = "" then facerand=16 randomize facerand=Int((facerand*rnd)+1) face="images/face/"&facerand&".gif" end if if body <> "" and Len(body)> bodymax then message=message&"对不起,留言字数不能超过 "&bodymax&" 字,谢谢!\n" end if if brow = "" then browrand=16 randomize browrand=Int((browrand*rnd)+1) brow="images/brow/"&browrand&".gif" end if if message1<> "" then call error1(""&message1&"") if message<> "" then call error(""&message&"") else sql = "select * from gbook" Set Rs = Server.CreateObject("ADODB.Recordset") Rs.open sql,conn,3,2 Rs.addnew Rs("username")=username Rs("zt")=zt Rs("email")=email Rs("homeurl")=homeurl Rs("qq")=qq Rs("body")=body Rs("face")=face Rs("brow")=brow Rs("ip")=ip Rs("addtime")=now Rs.update Rs.close session("OldGuestSave")="Saved" sql="select * from admin" Rs.open sql,conn,3,2 if date <> today_time then Rs("today_count") = 1 else Rs("today_count") = Rs("today_count")+1 end if Rs("today_time") = date Rs.update Rs.close set Rs = nothing conn.close set conn = nothing Response.redirect "index.asp" Response.End end if end sub %> <table width=754 height="50" align=center cellpadding=0 cellspacing=1 bgcolor="#99CCFF"> <tbody> <tr> <td width="750" align=center valign="middle" bgcolor="#FFFFf0"> <p><font size="-1" color="#333333"> 版权所有 </font></p> </td> </tr> </tbody> </table> <tr> <td align=middle height="3">