📄 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="70%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><script src="ubb.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" class="style2" maxlength="10" size="20"> *</td>
</tr>
<tr>
<td align="center">性别</td>
<td><input type="radio" name="sex" value="1" class="style1" checked>
帅哥
<input type="radio" name="sex" value="2" class="style1">
美女</td>
</tr>
<tr>
<td align="center">Q Q</td>
<td><input type="text" name="qq" class="style2" maxlength="15" size="20"></td>
</tr>
<tr>
<td align="center">email</td>
<td><input type="text" name="email" class="style2" maxlength="40" size="50"></td>
</tr>
<tr>
<td align="center">主页</td>
<td><input name="url" type="text" class="style2" value="http://" size="50" maxlength="40"></td>
</tr>
<tr>
<td align="center">类型</td>
<td><input type="radio" name="types" value="留言" class="style1"checked>留言
<input type="radio" name="types" value="建议" class="style1">建议
<input type="radio" name="types" value="报错" class="style1">报错
<input type="radio" name="types" value="交流" class="style1">交流
<input type="radio" name="types" value="其它" class="style1">其它
</tr>
<tr>
<td align="center">UBB</td>
<td><% call ubb %></td>
</tr>
<tr>
<td rowspan="2" align="center" class="style2">内容</td>
<td>
<%
dim ii
for i=1 to 48
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=16 or i=32 then response.write "<br>"
next
%></td></tr>
<tr>
<td>可写
<input disabled maxLength="4" name="total" size="3" value="300" class="style1">字 已写
<input disabled maxLength="4" name="used" size="3" value="0" class="style1">字 剩余
<input disabled maxLength="4" name="remain" size="3" value="300" class="style1">字<br>
<textarea name="content" cols="60" 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" class="style1" checked>
否
<input type="radio" name="hiden" value="1" class="style1">
是 <font color=#999999>(悄悄话,此留言只有管理员才可以看到)</font></td>
</tr>
<tr>
<td align="center">验 证 码</td>
<td><input name="adminid" type="text" size="5" maxlength="4" class="style2">
<img src="code.asp"></td>
</tr>
<tr>
<td> </td>
<td ><input name="submit" type="submit" value="确 定"class="style3">
<input name="submit2" type="reset" value="重 置" class="style3"></td>
</tr>
</table>
</form>
</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="email填写错误"
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 + -