📄 new.asp
字号:
<% Option Explicit %>
<%response.buffer=true%>
<!--#include file="Inc_common.asp"-->
<!--#include file="Ubb.asp"-->
<%
'**************************************
'** New.asp
'**
'** 文件说明:发表留言页面
'** 修改日期:2004-9-22
'** 作者:Howlion
'** Email:howlion@163.com
'**************************************
dim mainpic
mainpic="page_new.gif"
select case request("act")
case "addin"
call updata()
case else
call main()
end select
sub main()
pagename="写留言"
call pageinfo()
call skin1()
'---------------以下显示页面主体--------
if lock="1" then
dim errinfo
errinfo="抱歉,该留言本已经被管理员锁定,您无法留言。"
error(errinfo)
call skin2()
exit sub
end if
session("in")="true"
%>
<script language="JavaScript">
<!--
function Submitcheck(){
if (document.frmAnnounce.username.value.length==0){
alert("请输入您的称呼,此为必填项!");
document.frmAnnounce.username.focus();
return false;
}
if (document.frmAnnounce.usertitle.value.length==0){
alert("请输入留言标题,此为必填项!");
document.frmAnnounce.usertitle.focus();
return false;
}
if (document.frmAnnounce.usercontent.value.length==0){
alert("请输入留言正文,此为必填项!");
document.frmAnnounce.usercontent.focus();
return false;
}
return true
}
//-->
</script>
<script src="ubb.js"></script>
<br>
<form action="?act=addin" method='POST' onSubmit='return Submitcheck()' onSubmit='submitonce(this)' name="frmAnnounce">
<div align="center">
<table align="center" width="88%">
<tr>
<td><%=ubbcode(notice)%></td>
</tr>
</table>
<table align="center" cellpadding="3" cellspacing="1" class="table1" width="95%" style="border-collapse: collapse table-layout:fixed;word-break:break-all">
<tr>
<td width="20%" class="tablebody3" align="right" height="32"><img border="0" src="images/perinfo.gif"></td>
<td width="80%" class="tablebody2" height="32"><b>个人信息</b></td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">您的称呼:</td>
<td width="80%" class="tablebody2" height="19"><input name="username" size="19" maxlength="80"><B> 必填</B></td>
</tr>
<tr>
<td width="20%" class="tablebody3" valign="top" align="right" height="19">性别及头像:</td>
<td width="80%" class="tablebody2" height="19"> 男性:<img src="images/userfaces/small_1.gif" width="30" height="30"><input type="radio" value="1" name="userface" checked> <img src="images/userfaces/small_2.gif" width="30" height="30"><input type="radio" value="2" name="userface"> <img src="images/userfaces/small_3.gif" width="30" height="30"><input type="radio" value="3" name="userface"> <img src="images/userfaces/small_4.gif" width="30" height="30"><input type="radio" value="4" name="userface"> <img src="images/userfaces/small_5.gif" width="30" height="30"><input type="radio" value="5" name="userface"><br>
女性:<img src="images/userfaces/small_6.gif" width="30" height="30"><input type="radio" value="6" name="userface"> <img src="images/userfaces/small_7.gif" width="30" height="30"><input type="radio" value="7" name="userface"> <img src="images/userfaces/small_8.gif" width="30" height="30"><input type="radio" value="8" name="userface"> <img src="images/userfaces/small_9.gif" width="30" height="30"><input type="radio" value="9" name="userface"> <img src="images/userfaces/small_10.gif" width="30" height="30"><input type="radio" value="10" name="userface"><br>
中性:<img src="images/userfaces/small_11.gif" width="30" height="30"><input type="radio" value="11" name="userface"> <img src="images/userfaces/small_12.gif" width="30" height="30"><input type="radio" value="12" name="userface"> <img src="images/userfaces/small_13.gif" width="30" height="30"><input type="radio" value="13" name="userface"> <img src="images/userfaces/small_14.gif" width="30" height="30"><input type="radio" value="14" name="userface"> <img src="images/userfaces/small_15.gif" width="30" height="30"><input type="radio" value="15" name="userface"><p>提示:如果不想透露自己的性别,可以选一个中性的头像</B></FONT></td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">个人主页:</td>
<td width="80%" class="tablebody2" height="19"><input name="userurl" size="19" maxlength="80" value="http://"><br>如果要填写,应填写完整地址,如http://www.howlion.com/</td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">Email:</td>
<td width="80%" class="tablebody2" height="19"><input name="usermail" size="19" maxlength="80"></td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">QQ:</td>
<td width="80%" class="tablebody2" height="19"><input name="userqq" size="19" maxlength="80"></td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="35"><img border="0" src="images/lwcontent.gif"></td>
<td width="80%" class="tablebody2" height="35"><b>留言内容</b></td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">标题:</td>
<td width="80%" class="tablebody2" height="19"><input name="usertitle" size="40" maxlength="100"><B> 必填</B></td>
</tr>
<tr>
<td width="20%" class="tablebody3" valign="top" align="right" height="160">正文:</td><td width="80%" class="tablebody2" height="160"><!--#include file="Inc_ubb.asp"-->
<textarea cols="60" name="usercontent" title="Ctrl+Enter提交" rows="12" onkeydown=ctlent()></textarea><br>点击表情符号可以将其加入正文(正文内容不能大于<b><%=maxnum%></b>个字符)。<br>
<%
dim ii,i
for i=1 to 42
if len(i)=1 then ii="0" & i else ii=i
response.write "<img src=""images/faces/"&ii&".gif"" border=0 onclick=""insertsmilie('[face"&ii&"]')"" style=""CURSOR: hand""> "
if i=17 or i=34 then response.write "<br>"
next
%>
</td>
</tr>
<tr>
<td width="20%" class="tablebody3" align="right" height="19">悄悄话:</td>
<td width="80%" class="tablebody2" height="19"><input type="radio" value="1" name="whisper">是 <input type="radio" value="0" name="whisper" checked>否<BR> 提示:悄悄话只有管理员可见,这样就能防止普通访客看到留言</td>
</tr>
<tr>
<td valign="middle" colspan="2" align="center" class="tablebody1" height="21"><b><input type="Submit" value="提 交" name="Submit"> <input type="reset" name="Submit2" value="清 除"> </b></td>
</tr>
</table>
</div>
</form>
<%
conn.close
set rs=nothing
'--------------页面主题显示结束--------
call skin2()
end sub
sub updata()
dim errinfo
if not session("in")="true" then
errinfo="非法的提交动作!"
error(errinfo)
exit sub
end if
dim username,xingbie,userface,userurl,usermail,userqq,usertitle,usercontent,whisper,ip,checked,adderr,nameerr,adderr2,adderr3,nameerr2,titleerr,titleerr2,contenterr,contenterr2,urlerr,mailerr,qqerr
username=filter(Trim(request.Form("username")))
if request.Form("userface") < 6 then
xingbie=1
elseif request.Form("userface") < 11 then
xingbie=2
else
xingbie=3
end if
userface=request.Form("userface")
if filter(Trim(request.form("userurl")))="http://" then
userurl=""
else
userurl=filter(Trim(request.form("userurl")))
end if
usermail=filter(Trim(request.form("usermail")))
userqq=filter(Trim(request.form("userqq")))
usertitle=filter(Trim(request.form("usertitle")))
usercontent=filter(Trim(request.form("usercontent")))
whisper=request.form("whisper")
ip=Request.ServerVariables("REMOTE_ADDR")
if username="" then
adderr=true
nameerr=true
elseif len(username)>20 then
adderr2=true
nameerr2=true
end if
if usertitle="" then
adderr=true
titleerr=true
elseif len(usertitle)>50 then
adderr2=true
titleerr2=true
end if
if usercontent="" then
adderr=true
contenterr=true
elseif len(usercontent)>maxnum then
adderr2=true
contenterr2=true
end if
If userurl<>"" then
dim url
url=Split(userurl, ".")
if UBound(url) <> 1 and UBound(url) <> 2 and UBound(url) <> 3 and UBound(url) <> 4 then
adderr3=true
urlerr=true
end if
end if
If usermail<>"" then
dim email1,email2
email1=Split(usermail, "@")
email2=Split(usermail, ".")
if UBound(email1) <> 1 or UBound(email2) = 0 then
adderr3=true
mailerr=true
end if
end if
if trim(userqq)<>"" then
if not(isnumeric(userqq)) then
adderr3=true
qqerr=true
end if
end if
if username=name then
response.write"<script>alert('请勿使用管理员的名称留言!');location='javascript:history.back(1)'</script>"
exit sub
end if
if adderr=true or adderr2=true or adderr3=true then
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%" height="70%" align="center">
<tr>
<td width="100%" height="210">
<table class="table1" border="0" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="187">
<tr>
<td width="100%" class="tablebody1" height="16">
<p align="center"><img border="0" src="images/error.gif">
<p align="center"><%if adderr=true then%>以下内容没有填写:<%end if%><%if nameerr=true then%>『您的称呼』<%end if%><%if titleerr=true then%>『留言标题』<%end if%><%if contenterr=true then%>『留言正文』<%end if%><br>
<%if adderr2=true then%>以下内容超过限制的字数:<%end if%><%if nameerr2=true then%>『您的称呼』<%end if%><%if titleerr2=true then%>『留言标题』<%end if%><%if contenterr2=true then%>『留言正文』<%end if%><br>
<%if adderr3=true then%>以下内容格式错误:<%end if%><%if urlerr=true then%>『主页地址』<%end if%><%if mailerr=true then%>『Email信箱』<%end if%><%if qqerr=true then%>『QQ号码』<%end if%><br>
<br><br>
<a href="javascript:history.back(1)">《《 <b>返回重新填写</b></a></td>
</tr>
</table>
</td>
</tr>
</table>
<%
else
if needcheck=0 or whisper=1 then
checked=1
else
checked=0
end if
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from topic"
rs.open sql,conn,3,2
rs.addnew
rs("username")=username
rs("xingbie")=xingbie
rs("userface")=userface
rs("userurl")=userurl
rs("usermail")=usermail
rs("userqq")=userqq
rs("usertime")=now()
rs("usertitle")=usertitle
rs("usercontent")=usercontent
rs("whisper")=whisper
rs("top")="0"
rs("reply")="0"
rs("ip")=ip
rs("checked")=checked
rs.update
rs.close
session("in")="0"
if checked=0 then
response.write"<script>alert('留言已成功提交,但需要通过审核后才会显示。');location='Index.asp'</script>"
else
Response.Redirect "Index.asp"
Response.Flush
end if
end if
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -