📄 add_message.asp
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=urlname%> - 发表留言</title>
</head>
<body onselectstart="return false">
<!--#include file="top.asp"-->
<%
select case request("act")
case "new"
call updata()
case else
call main()
end select
sub main()
if locks="1" then
errinfo="留言本已被锁定,暂时不开放留言功能"
error(errinfo)
exit sub
end if
%>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="4%"><img src="images/skin/t-tl.gif" width="31" height="29"></td>
<td width="91%" background="images/skin/t-tc.gif"> </td>
<td width="5%"><img src="images/skin/t-tr.gif" width="35" height="29"></td>
</tr>
<tr>
<td background="images/skin/t-lt.gif"> </td>
<td><script src="topic.js"></script>
<form action="?act=new" method="post" name="topic" onSubmit="return check()">
<table width="580"border="1" align="center" cellspacing="0" cellpadding="3" bgcolor="#FFFFFF" bordercolor="#f0f0f0" style="border-collapse: collapse">
<tr>
<td width="70" align="center">您的昵称</td>
<td width="492"><input type="text" name="name" maxlength="10" size="20"> *</td>
</tr>
<tr>
<td align="center">您的性别</td>
<td><input type="radio" name="sex" value="1" checked>
帅哥
<input type="radio" name="sex" value="2">
美女</td>
</tr>
<tr>
<td align="center">腾迅Q Q</td>
<td><input type="text" name="qq" maxlength="15" size="20"></td>
</tr>
<tr>
<td align="center">E_Mail</td>
<td><input type="text" name="email" maxlength="40" size="50"></td>
</tr>
<tr>
<td align="center">个人主页</td>
<td><input name="url" type="text" value="http://" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="center">留言类型</td>
<td><input type="radio" name="types" value="留言" checked>
<font color=#0000FF>留言</font>
<input type="radio" name="types" value="建议">
<font color=#FF00FF>建议 </font>
<input type="radio" name="types" value="报错">
<font color=#FF7F50>报错</font>
<input type="radio" name="types" value="连接">
<font color=#228B22>连接</font>
<input type="radio" name="types" value="其它">
<font color=#1E90FF>其它</font></td>
</tr>
<tr>
<td align="center">UBB</td>
<td><% call ubb %></td>
</tr>
<tr>
<td rowspan="2" align="center">留言内容</td>
<td>
<%
dim ii
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('[pic"&ii&"]')"" style=""CURSOR: hand""> "
if i=14 or i=28 then response.write "<br>"
next
%></td>
</tr>
<tr>
<td>字限:
<input disabled maxLength="4" name="total" size="3" value="300">
字;
已写:
<input disabled maxLength="4" name="used" size="3" value="0">
字;
剩余:
<input disabled maxLength="4" name="remain" size="3" value="300">
字<br>
<textarea name="content" cols="50" rows="10" wrap="virtual" onKeyUp="count(this.form.content,this.form.total,this.form.used,this.form.remain)"></textarea></td></tr>
<tr>
<td align="center">是否隐藏</td>
<td><input type="radio" name="hiden" value="0" checked>
否
<input type="radio" name="hiden" value="1">
是 <font color=#999999>选择隐藏后,此留言只有管理员可以看到</font></td>
</tr>
<tr>
<td align="center">验 证 码</td>
<td><input name="adminid" type="text" size="5" maxlength="4">
<img src="code.asp"></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" value="确 定">
<input name="submit2" type="reset" value="重 置"></td>
</tr>
</table>
</form>
</td>
<td background="images/skin/t-rt.gif"> </td>
</tr>
<tr>
<td><img src="images/skin/t-bl.gif" width="31" height="32"></td>
<td background="images/skin/t-bc.gif"></td>
<td><img src="images/skin/t-br.gif" width="35" height="32"></td>
</tr>
</table>
<%
end sub
sub updata()
If Not ChkPost Then
errinfo="对不起,请不要从外部提交数据"
error(errinfo)
exit sub
End If
dim names,sex,qq,url,email,types,content,hiden,adminid,topic
names=Trim(Request.Form("name"))
sex=request.Form("sex")
qq=Trim(Request.Form("qq"))
email=Trim(Request.Form("email"))
if Trim(Request.Form("url"))="http://" then
url=""
else
url=Trim(Request.Form("url"))
end if
types=request.form("types")
content=Trim(Request.Form("content"))
hiden=request.Form("hiden")
adminid=request.Form("adminid")
topic=session("topic")
if topic+3/8640>=now() then
errinfo="你已经留言成功,请不要重复留言"
error(errinfo)
exit sub
end if
if names="" then
errinfo="『您的昵称』没有填写"
error(errinfo)
exit sub
end if
if not check_name(names) then
errinfo="『您的昵称』名含有非法字符"
error(errinfo)
exit sub
end if
if qq<>"" then
if not(isnumeric(qq)) then
errinfo="『腾迅Q Q』填写错误"
error(errinfo)
exit sub
end if
end if
If email<>"" then
email=HTMLEncode(email)
if not IsValidEmail(email) then
errinfo="『E_Mail』填写错误"
error(errinfo)
exit sub
end if
end if
If url<>"" then
dim url1
url1=Split(url, ".")
if UBound(url1) <> 1 and UBound(url1) <> 2 and UBound(url1) <> 3 and UBound(url1) <> 4 then
errinfo="『个人主页』填写错误"
error(errinfo)
exit sub
end if
end if
if content="" then
errinfo="『留言内容』没有填写"
error(errinfo)
exit sub
end if
if session("adminid")<>adminid or not isnumeric(adminid) or adminid="" then
errinfo="验证码输入错误,请输入正确的验证码"
error(errinfo)
exit sub
end if
session("topic")=now()
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from Topic"
rs.open sql,conn,3,2
rs.addnew
rs("username")=names
rs("sex")=sex
rs("qq")=qq
rs("url")=url
rs("mail")=email
rs("type")=types
rs("usercontent")=content
rs("views")=hiden
rs("usertime")=now()
rs.update
rs.close
sucinfo="留言提交成功"
suc(sucinfo)
end sub%>
<!--#include file="bottom.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -