📄 lyb.asp
字号:
<%
Response.Expires=0
dim input()
'读取guestadd.htm表单中的各项内容
name = Request.Form("name")
from = Request.Form("from")
email = Request.Form("email")
homename = Request.Form("homename")
url = Request.Form("url")
ly = Request.Form("ly")
ip = Request.ServerVariables("REMOTE_ADDR")
'取得服务器上当前日期和时间
n=Year(date())
y=Month(date())
r=Day(date())
s=Hour(time())
f=Minute(time())
m=Second(time())
if len(y)=1 then y="0" & y
if len(r)=1 then r="0" & r
if len(s)=1 then s="0" & s
if len(f)=1 then f="0" & f
if len(m)=1 then m="0" & m
sj=n & "年" & y & "月" & r & "日" & " " & weekdayname(weekday(date())) & " " & s & ":" & f & ":" & m
'检查姓名、主页名称、地址、留言是否为空
if name = "" then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>啊哈!您忘了什么东东了吧</p>"
Response.write "<p align='center'>您怎么会没有尊姓大名呢,没有大名,小名也可以呀</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
if homename <> "" and (url = "http://" or url = "") then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>啊哈!您忘了什么东东了吧</p>"
Response.write "<p align='center'>您有主页为什么没有 URL 地址呢</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
if left(url,7)<>"http://" then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>啊哈!您是不是打错了</p>"
Response.write "<p align='center'>请再检查一下您的主页地址输入是否正确</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
if ly = "" then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>啊哈!您忘了什么东东了吧</p>"
Response.write "<p align='center'>留言不能不输呀?请留言下您的宝贵意见</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
if len(ly) > 400 then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>对不起,留言长度不能超过400个字符。</p>"
Response.write "<p align='center'>注:一个汉字等于两个字符的宽度。</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
'格式化留言使其不支持HTML,使留言薄支持HTML,可删除此段代码
name=server.HTMLEncode(name)
from=server.HTMLEncode(from)
if from="" then from="0"
email=server.HTMLEncode(email)
if email="" then email="0"
homename=server.HTMLEncode(homename)
if homename="" then homename="0"
url=server.HTMLEncode(url)
if url="" or url="http://" then url="0"
ly=server.HTMLEncode(ly)
lytemp = ""
for i = 1 to len(ly)
zh = mid(ly,i,1)
if zh=" " then zh = " "
if asc(zh)=10 then zh = "<br>"
if asc(zh)=13 then zh = ""
lytemp = lytemp + zh
next
ly = lytemp
'把文件内容读到 input() 数组中
lyfile = server.mappath("ly.asp")
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(lyfile,1,False)
counter = 0
do while not thisfile.AtEndOfStream
thisline = thisfile.readline
Redim preserve input(counter)
input(counter) = thisline
counter = counter + 1
loop
thisfile.Close
'检查留言是否重复
if counter> 1 then
if ly=input(1) then
Response.write "<body bgcolor=#FFCC99><p> </p><p align='center'>由于本留言薄只保留最近的150条留言</p>"
Response.write "<p align='center'>所以相同的留言请不要反复粘贴,谢谢合作。</p>"
Response.write "<p align='center'><a href='javascript:history.go(-1);'>点击这里进行修改</a></p></body>"
Response.end
end if
end if
Set outfile = fs.CreateTextFile(lyfile)
outfile.WriteLine input(0)
outfile.WriteLine ly
outfile.WriteLine name
outfile.WriteLine email
outfile.WriteLine sj
outfile.WriteLine from
outfile.WriteLine homename
outfile.WriteLine url
if counter>1043 then
countline=1043
for i=1 to countline
outfile.WriteLine input(i)
next
else
for i=1 to counter-1
outfile.WriteLine input(i)
next
end if
outfile.close
'记录下加入的留言数
cf=server.mappath("chatguestbook_add.txt")
Set fs = CreateObject ("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(cf)
vs=thisfile.readline
thisfile.close
vs=vs + 1
Set thisfile = fs.CreateTextFile(cf)
thisfile.WriteLine(vs)
thisfile.close
set fs=nothing
Response.Redirect "chatguestbook.asp?id=1"
Response.end
%>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -