📄 post.asp
字号:
<!--#include file="zwd.asp"-->
<script language="JavaScript">
function closeit()
{setTimeout("self.close()",10)}</script>
<%
function htmlencode2(str)
dim result
dim l
if isNULL(str) then
htmlencode2=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
result=result+"<br>"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
next
htmlencode2=result
end function
sub chkInput()
if Trim(sName)="" then
sName="匿名"
elseif len(sName)>=50 then
foundError=true
ErrorMsg=ErrorMsg+"您 输 入 的 “大 名” 的 长 度 不 能 大 于 50 !"
end if
if len(sEmail)>255 then
foundError=true
ErrorMsg=ErrorMsg+"您 输 入 的 “E-Mail” 的 长 度 不 能 大 于 255 !"
end if
if Trim(sTitle)="" then
sTitle="<无主题>"
elseif len(sTitle)>255 then
foundError=true
ErrorMsg=ErrorMsg+"您 输 入 的 “主 题” 的 长 度 不 能 大 于 255 !"
end if
if len(sHomePage)>255 then
foundError=true
ErrorMsg=ErrorMsg+"您 输 入 的 “主 页” 的 长 度 不 能 大 于 255 !"
end if
if Trim(sInput)="" then
foundError=true
ErrorMsg=ErrorMsg+"没 有 留 言 , 请 留 下 您 的 宝 贵 意 见 !"
elseif len(sInput)>16384 then
foundError=true
ErrorMsg=ErrorMsg+"您 输 入 的 “留 言” 的 长 度 不 能 大 于 16384 (16K)!"
end if
end sub
sub getInput()
sName=trim(request.form("txtName"))
sEmail=trim(request.form("txtEmail"))
sHomePage=trim(request.form("txtHomePage"))
sFace=trim(request.form("face"))
sTitle=trim(request.form("txtTitle"))
sInput=trim(request.form("txtContent"))
end sub
%>
<%
dim sql
dim rs
dim sName
dim sEmail
dim sTitle
dim sFace
dim sHomePage
dim sInput
dim foundError
dim errorMsg
getInput()
chkInput()
if foundError then
call showErrors()
else
saveData()
if foundError then
call showErrors()
else
end if
end if
sub saveData()
sql = "SELECT * FROM book where name is null"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("name") =htmlencode2(sName)
rs("email") =htmlencode2(sEmail)
rs("homepage") =htmlencode2(sHomePage)
rs("face") =sFace
rs("title") =htmlencode2(sTitle)
rs("content") =htmlencode2(sInput)
rs("time") =cstr(now())
rs.Update
end sub%>
<script language="JavaScript">
closeit()
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -