📄 new.asp
字号:
<% Option Explicit %>
<%response.buffer=true%>
<!--#include file="Inc_common.asp"-->
<!--#include file="Ubb.asp"-->
<%
'**************************************
'** New.asp
'**
'** 文件说明:发表留言页面
'** 修改日期:2004-11-12
'** 作者:HACKer007
'** Email:panyisi5201314@tom.com
'**************************************
dim mainpic
mainpic="page_new.gif"
if lock="1" then
errinfo="<li>留言本已经被管理员锁定,您无法留言。"
call error()
end if
select case request("act")
case "addnew"
call addnew()
case else
call main()
end select
sub main()
pagename="写留言"
call pageinfo()
call skin1()
'---------------以下显示页面主体--------
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>
<body>
<p><br>
</p>
<form action="?act=addnew" method="POST" onSubmit="return Submitcheck()" name="frmAnnounce">
<div align="center">
<table align="center" width="92%">
<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%" bgcolor="#FFFFFF" align="right" height="32">
<img border="0" src="images/perinfo.gif"></td>
<td width="80%" bgcolor="#FFFFFF" height="32"><b><FONT COLOR="#4B4B4B">个人信息</FONT></b></td>
</tr>
<tr>
<td width="20%" class="tablebody2" align="right" height="19">
<font FACE="宋体" COLOR="red">***</font> <b>您的称呼:</b></td>
<td width="80%" class="tablebody3" height="19">
<input name="username" size="19" maxlength="80"></td>
</tr>
<tr>
<td width="20%" class="tablebody2" valign="top" align="right" height="19">
性别及头像:</td>
<td width="80%" class="tablebody3" 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="tablebody2" align="right" height="19">个人主页:</td>
<td width="80%" class="tablebody3" height="19">
<input name="userurl" size="19" maxlength="80" value="http://"><br>
如果要填写,应填写完整地址;</td>
</tr>
<tr>
<td width="20%" class="tablebody2" align="right" height="19">Email:</td>
<td width="80%" class="tablebody3" height="19">
<input name="usermail" size="19" maxlength="80"></td>
</tr>
<tr>
<td width="20%" class="tablebody2" align="right" height="19">QQ:</td>
<td width="80%" class="tablebody3" height="19">
<input name="userqq" size="19" maxlength="80"></td>
</tr>
<tr>
<td width="20%" bgcolor="#FFFFFF" align="right" height="35">
<img border="0" src="images/lwcontent.gif"></td>
<td width="80%" bgcolor="#FFFFFF" height="35"><b><FONT COLOR="#4B4B4B">留言内容</FONT></b></td>
</tr>
<tr>
<td width="20%" class="tablebody2" align="right" height="19">
<font FACE="宋体" COLOR="red">***</font> <b>标题:</b></td>
<td width="80%" class="tablebody3" height="19">
<input name="usertitle" size="40" maxlength="100"></td>
</tr>
<tr>
<td width="20%" class="tablebody2" valign="top" align="right" height="160">
<font FACE="宋体" COLOR="red">***</font> <b>正文:</b></td>
<td width="80%" class="tablebody3" 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="tablebody2" align="right" height="19"></td>
<td width="80%" class="tablebody3" height="19">悄悄话<input type="checkbox" name="whisper" value="1"> 回复查看码(可不填):<input name="replycode" size="20" maxlength="100"><p>
提示:<b>回复查看码</b>用于以后查看管理员对悄悄话的回复,若不填,管理员将无法回复您的悄悄话。</td>
</tr>
<tr>
<td valign="middle" colspan="2" align="center" class="tablebody1" height="21">
<input type="Submit" name="Submit" value="提 交">
<input type="reset" name="Submit2" value="清 除">
<input type="button" name="Preview" value="预览" onclick="openpreview()">
</td>
</tr>
</table>
</div>
</form>
<form name="preview" action="Preview.asp" method="post" target="preview_page">
<input type="hidden" name="usertitle" value>
<input type="hidden" name="usercontent" value>
</form>
<%
'--------------页面主题显示结束--------
call skin2()
end sub
sub addnew()
dim servername1,servername2
servername1=Cstr(Request.ServerVariables("HTTP_REFERER"))
servername2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(servername1,8,len(servername2))<>servername2 or (not session("in")="true") then
errinfo="<li>非法的提交动作!"
end if
dim username,xingbie,userface,userurl,usermail,userqq
dim usertitle,usercontent,whisper,checked,replycode
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=filter(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(Rtrim(request.form("usercontent")))
if not request.form("whisper")="1" then
whisper=0
else
whisper=1
end if
replycode=filter(Trim(request.form("replycode")))
if username="" then
errinfo=errinfo & "<li>未填写您的称呼"
elseif len(username)>20 then
errinfo=errinfo & "<li>过长的称呼"
end if
if usertitle="" then
errinfo=errinfo & "<li>未填写标题"
elseif len(usertitle)>50 then
errinfo=errinfo & "<li>过长的标题"
end if
if Trim(Replace(request.form("usercontent"), CHR(13)&CHR(10), ""))="" then
errinfo=errinfo & "<li>未填写留言内容"
elseif len(usercontent)>maxnum then
errinfo=errinfo & "<li>过长的留言内容"
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
errinfo=errinfo & "<li>个人主页地址填写有误"
elseif len(userurl)>100 then
errinfo=errinfo & "<li>过长的个人主页地址"
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
errinfo=errinfo & "<li>Email填写有误"
elseif len(usermail)>80 then
errinfo=errinfo & "<li>过长的Email地址"
end if
end if
if trim(userqq)<>"" then
if not(isnumeric(userqq)) then
errinfo=errinfo & "<li>QQ号码填写有误"
elseif len(userqq)>12 then
errinfo=errinfo & "<li>过长的QQ号码"
end if
end if
if len(replycode)>60 then
errinfo=errinfo & "<li>过长的回复查看码"
end if
if username=name then
errinfo=errinfo & "<li>请勿使用管理员的名称"
end if
call error()
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("replycode")=replycode
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
if whisper=1 then
if replycode="" then
response.write"<script>alert('悄悄话留言已成功提交,但您没有填写回复查看码,管理员将无法回复您的发言,您也无法查看回复。');location='Index.asp'</script>"
else
response.write"<script>alert('悄悄话留言已成功提交,您可以在管理员回复后,通过输入回复查看码,查看回复内容。');location='Index.asp'</script>"
end if
else
Response.Redirect "Index.asp"
Response.Flush
end if
end if
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -