|
<%
select case request("act")
case "add"
call add_update()
case else
call add_main()
end select
%>
<%
sub add_main()
session("in") = "true"
if lock="1" then
errinfo="抱歉,该留言本已经被管理员锁定,无法留言"
error (errinfo)
exit sub
end if
%>
<%
end sub
sub add_update()
if not session("in")= "true" then
errinfo = "非法的提交动作,"
error(errinfo)
exit sub
end if
dim uid,sex,home,email,qq,utime,title,ip,content
uid = trim(request.form("uid"))
sex = Trim(request.form("sex"))
if trim(request.form("home"))="http://" then
home=""
else
home = trim(Request.Form("home"))
end if
email = Trim(request.form("email"))
qq = Trim(request.form("qq"))
title = Trim(request.form("title"))
ip = request.serverVariables("remote_addr")
content = Trim(request.form("content"))
if uid="" then
adderr=true
uiderr=true
elseif len(uid)>20 then
adderr2=true
uiderr2=true
end if
if title="" then
adderr=true
titleerr=true
elseif len(title)>50 then
adderr2 = true
titleerr2 = true
end if
if content="" then
adderr = true
contenterr = true
elseif len(content)>maxnum then
adderr2 = true
contenterr2 = true
end if
'if home<>"" then
' dim url
' url=split(home,".")
' if UBound(url)<>1 and UBound<>2 and UBound(url)<>3 and UBound(url)<>4 then
' adderr3 = true
' urlerr=true
' end if
'end if
if email<>"" then
dim email1,email2
email1= split(email,"@")
email2= split(email,".")
if UBound(email1)<>1 and Ubound(email2) = 0 then
adderr3 = true
emailerr = true
end if
end if
if Trim(request.form("qq"))<>"" then
if not (isnumeric(qq)) then
adderr3=true
qqerr=true
end if
end if
if adderr=true or adderr2=true or adderr3=true then
%>
<%
exit sub
end if
set rs = server.createobject("adodb.recordset")
sql="select * from mainbook"
rs.open sql,db,3,2
rs.addnew
rs("uid")=uid
rs("sex")=sex
rs("home")=home
rs("email")=email
rs("qq")=qq
rs("utime")=now()
rs("title")=title
rs("ip")=ip
rs("content")=content
rs("top")="0"
rs("reply")="0"
rs.update
rs.close
%>
<%
session("in")="0"
end sub
%>
|