📄 book.asp
字号:
If Len(Request.Form("name"))>10 Then
Response.Write "<script>alert('您的名字太长了!');this.location.href='book.asp?action=addbook';</script>"
Response.End
End If
If Request.Form("email")<>"" Then
If instr(Request.Form("email"),"@")=0 or instr(Request.Form("email"),"@")=1 or instr(Request.Form("email"),"@")=len(email) then
web58818CMS("<script>alert('电子信箱格式填写不正确!');this.location.href='book.asp?action=addbook';</script>")
Response.End
End If
End If
If Request.Form("qq")<>"" Then
If Len(Request.Form("qq"))<5 or Len(Request.Form("qq"))>10 or Not IsNumeric(Request.Form("qq")) then
web58818CMS("<script>alert('QQ号码错误:\n\n1. QQ号码只能是数字。\n\n2. QQ号码不能低于4位数 \n\n3. QQ号码不能高于9位数\n\n4. 如果您没有QQ号码可以不填!');this.location.href='book.asp?action=addbook';</script>")
Response.End
End If
End If
If Trim(Request.Form("content"))="" Then
web58818CMS("<script>alert('留言内容不能为空!');this.location.href='book.asp?action=addbook';</script>")
Response.End
End If
If Request.Form("content")<>"" Then
If Len(Request.Form("content"))<5 or Len(Request.Form("content"))>300 then
web58818CMS("<script language=javascript>alert('错误提示:\n\n1. 留言内容不得低于5个字!\n\n2. 留言内容不得高于300个字,长篇大论请到论坛发表!');this.location.href='book.asp?action=addbook';</script>")
Response.End
End If
End If
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From YC_book"
Rs.Open Sql,Conn,2,3
Rs.AddNew
Rs("name")=Server.HTMLEncode(Request.Form("name"))
Rs("subject")=Server.HTMLEncode(Request.Form("subject"))
Rs("sex")=Server.HTMLEncode(Request.Form("sex"))
Rs("qq")=Server.HTMLEncode(Request.Form("qq"))
Rs("web")=Server.HTMLEncode(Request.Form("web"))
Rs("email")=Server.HTMLEncode(Request.Form("email"))
Rs("admin")=cint(Request.Form("admin"))
Rs("title")=Server.HTMLEncode(Request.Form("title"))
Rs("content")=Server.HTMLEncode(Request.Form("content"))
Rs("date")=now()
Rs("ip")=request.servervariables("remote_addr")
Rs.Close
web58818CMS("<script>location.href='book.asp';</script>")
response.end
Set Rs = Nothing
'◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆
'◇功 能:编辑留言 ◆
'◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
case "editbook"
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From YC_book Where id="&Request.QueryString("id")
Rs.Open Sql,Conn,1,1%>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td class=righttopleft></td>
<td class=righttopcenter> 当前位置:<a href="index.asp"><font color=#007100>本站首页</font></a>→<a href="book.asp"><font color=#007100>访客留言→编辑回复留言</font></td>
</tr></table>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td class=rightcenterleft></td>
<td class=rightcentercenter valign=top><%call br%>
<table width=100% border=0 cellpadding=3 class='rightcentercenter'>
<form name="reply" method="post" action="book.asp?action=editok">
<tr><TD align="center">来客留言内容</TD></tr><tr>
<td align="center"><textarea name="content" cols="60" rows="5" class='web58818'><%=Rs("content")%></textarea></td></tr>
<tr>
<TD align="center">回复内容</TD></tr><tr>
<td align="center"><textarea name="reply" cols="60" rows="5" class='web58818'><%=Rs("reply")%></textarea></td></tr>
<tr align="center"><td colspan="2">
<input type="hidden" name="user" value="<%=session("superuser")%>">
<input type="hidden" name="id" value="<%=Request.QueryString("id")%>">
<input type="submit" name="Submit" value="编 辑" id=""Submit"" onmouseover="this.className='overput'"" onmouseout="this.className='put'" class="put"></td></tr></form><tr align="center"><td bgcolor="#F0f0f0" height="1"></td></tr>
</table>
</TD></TR></table>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td class=rightfootleft></td>
<td class=rightfootcenter></td></tr></table>
<%case "editok"
'◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆
'◇功 能:编辑留言处理 ◆
'◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
if session("superlogin")<>web58818 then
web58818CMS("<script>alert('您还未登陆管理,无法进行编辑留言!');this.location.href='book.asp';</script>")
response.end
else
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From YC_book Where id="&Request.Form("id")
Rs.Open Sql,Conn,2,3
Rs("content") = Server.HTMLEncode(Request.Form("content"))
Rs("reply") = Server.HTMLEncode(Request.Form("reply"))
Rs("admin") = cint(Request.Form("admin"))
Rs("replydate")=now()
Rs.Close
Set Rs=Nothing
web58818CMS("<script>this.location.href='book.asp';</script>")
response.end
end if
'◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆
'◇功 能:删除留言 ◆
'◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
case "shanchu"
if session("superlogin")<>web58818 then
web58818CMS("<script>alert('您还未登陆管理,无法删除!');this.location.href='book.asp';</script>")
else
Conn.Execute("Delete * From YC_book Where id="&Request.QueryString("id"))
web58818CMS("<script>this.location.href='book.asp';</script>")
end if
End Select%>
</td></tr></table><%call br()%>
</td><td class=right></td></tr></table>
<%Call foot()
function unHtml(content)
unHtml=content
if content <> "" then
unHtml=replace(unHtml,"<","<")
unHtml=replace(unHtml,">",">")
unHtml=replace(unHtml,chr(34),""")
unHtml=replace(unHtml,chr(13),"<br>")
unHtml=replace(unHtml,chr(32)," ")
end if
end function
function ubb(content)
ubb=content
nowtime=now()
UBB=Convert(ubb,"code")
UBB=Convert(ubb,"html")
UBB=Convert(ubb,"url")
UBB=Convert(ubb,"color")
UBB=Convert(ubb,"font")
UBB=Convert(ubb,"size")
UBB=Convert(ubb,"quote")
UBB=Convert(ubb,"email")
UBB=Convert(ubb,"img")
UBB=Convert(ubb,"swf")
UBB=AutoURL(ubb)
ubb=replace(ubb,"[b]","<b>",1,-1,1)
ubb=replace(ubb,"[/b]","</b>",1,-1,1)
ubb=replace(ubb,"[i]","<i>",1,-1,1)
ubb=replace(ubb,"[/i]","</i>",1,-1,1)
ubb=replace(ubb,"[u]","<u>",1,-1,1)
ubb=replace(ubb,"[/u]","</u>",1,-1,1)
ubb=replace(ubb,"[blue]","<font color='#000099'>",1,-1,1)
ubb=replace(ubb,"[/blue]","</font>",1,-1,1)
ubb=replace(ubb,"[red]","<font color='#990000'>",1,-1,1)
ubb=replace(ubb,"[/red]","</font>",1,-1,1)
for i=1 to 28
ubb=replace(ubb,"{:em"&i&"}","<IMG SRC=emot/emotface/em"&i&".gif></img>",1,6,1)
ubb=replace(ubb,"{:em"&i&"}","",1,-1,1)
next
ubb=replace(ubb,"["&chr(176),"[",1,-1,1)
ubb=replace(ubb,chr(176)&"]","]",1,-1,1)
ubb=replace(ubb,"/"&chr(176),"/",1,-1,1)
end function
function isInteger(para)
'on error resume next
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
end function
function Convert(ubb,CovT)
cText=ubb
startubb=1
do while Covt="url" or Covt="color" or Covt="font" or Covt="size"
startubb=instr(startubb,cText,"["&CovT&"=",1)
if startubb=0 then exit do
endubb=instr(startubb,cText,"]",1)
if endubb=0 then exit do
Lcovt=Covt
startubb=startubb+len(lCovT)+2
text=mid(cText,startubb,endubb-startubb)
codetext=replace(text,"[","["&chr(176),1,-1,1)
codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)
codetext=replace(codetext,"/","/"&chr(176),1,-1,1)
select case CovT
case "color"
cText=replace(cText,"[color="&text&"]","<font color='"&text&"'>",1,1,1)
cText=replace(cText,"[/color]","</font>",1,1,1)
case "font"
cText=replace(cText,"[font="&text&"]","<font face='"&text&"'>",1,1,1)
cText=replace(cText,"[/font]","</font>",1,1,1)
case "size"
if IsNumeric(text) then
if text>6 then text=6
if text<1 then text=1
cText=replace(cText,"[size="&text&"]","<font size='"&text&"'>",1,1,1)
cText=replace(cText,"[/size]","</font>",1,1,1)
end if
case "url"
cText=replace(cText,"[url="&text&"]","<a href='"&codetext&"' target=_blank>",1,1,1)
cText=replace(cText,"[/url]","</a>",1,1,1)
case "email"
cText=replace(cText,"["&CovT&"="&text&"]","<a href=mailto:"&text&">",1,1,1)
cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)
end select
loop
startubb=1
do
startubb=instr(startubb,cText,"["&CovT&"]",1)
if startubb=0 then exit do
endubb=instr(startubb,cText,"[/"&CovT&"]",1)
if endubb=0 then exit do
Lcovt=Covt
startubb=startubb+len(lCovT)+2
text=mid(cText,startubb,endubb-startubb)
codetext=replace(text,"[","["&chr(176),1,-1,1)
codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)
codetext=replace(codetext,"/","/"&chr(176),1,-1,1)
select case CovT
case "url"
cText=replace(cText,"["&CovT&"]"&text,"<a href='"&codetext&"' target=_blank>"&codetext,1,1,1)
cText=replace(cText,"<a href='"&codetext&"' target=_blank>"&codetext&"[/"&CovT&"]","<a href="&codetext&" target=_blank>"&codetext&"</a>",1,1,1)
case "email"
cText=replace(cText,"["&CovT&"]","<a href=mailto:"&text&">",1,1,1)
cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)
case "html"
codetext=replace(codetext,"<br>",chr(13),1,-1,1)
codetext=replace(codetext," ",chr(32),1,-1,1)
Randomize
rid="temp"&Int(100000 * Rnd)
cText=replace(cText,"[html]"&text,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext,1,1,1)
cText=replace(cText,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"[/html]","代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"</TEXTAREA><INPUT onclick=runEx('"&rid&"') type=button value=运行此段代码 name=Button1 class='Tips_bo'> <INPUT onclick=JM_cc('"&rid&"') type=button value=复制到我的剪贴板 name=Button2 class='Tips_bo'>",1,1,1)
case "img"
cText=replace(cText,"[img]"&text,"<a href="&chr(34)&"about:<img src="&codetext&" border=0>"&chr(34)&" target=_blank><img src="&codetext,1,1,1)
cText=replace(cText,"[/img]"," vspace=2 hspace=2 border=0 alt=::点击图片在新窗口中打开::></a>",1,1,1)
case "code"
cText=replace(cText,"[code]"&text,"以下内容为程序代码<hr noshade>"&codetext,1,1,1)
cText=replace(cText,"以下内容为程序代码<hr noshade>"&codetext&"[/code]","以下内容为程序代码<hr noshade>"&codetext&"<hr noshade>",1,1,1)
case "quote"
atext=replace(text,"[img]","",1,-1,1)
atext=replace(atext,"[/img]","",1,-1,1)
atext=replace(atext,"[swf]","",1,-1,1)
atext=replace(atext,"[/swf]","",1,-1,1)
atext=replace(atext,"[html]","",1,-1,1)
atext=replace(atext,"[/html]","",1,-1,1)
atext=SplitWords(atext,350)
atext=replace(atext,chr(32)," ",1,-1,1)
cText=replace(cText,"[quote]"&text,"<blockquote><hr noshade>"&atext,1,1,1)
cText=replace(cText,"<blockquote><hr noshade>"&atext&"[/quote]","<blockquote><hr noshade>"&atext&"<hr noshade></blockquote>",1,1,1)
case "swf"
cText=replace(cText,"[swf]"&text,"影片地址:<br>"&text&"<br><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>",1,1,1)
cText=replace(cText,"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"[/swf]","<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"</embed></object>",1,1,1)
end select
loop
Convert=cText
end function
function AutoURL(ubb)
cText=ubb
startubb=1
do
startubb=1
endubb_a=0
endubb_b=0
endubb=0
startubb=instr(startubb,cText,"http://",1)
if startubb=0 then exit do
endubb_b=instr(startubb,cText,"<",1)
endubb_a=instr(startubb,cText," ",1)
endubb=endubb_a
if endubb=0 then
endubb=endubb_b
end if
if endubb_b<endubb and endubb_b>0 then
endubb=endubb_b
end if
if endubb=0 then
lenc=ctext
endubb=len(lenc)+1
end if
if startubb>endubb then exit do
text=mid(cText,startubb,endubb-startubb)
codetext=text
urllink="<a href='"&codetext&"' target=_blank>"&codetext&"</a> "
urllink=replace(urllink,"/","/"&chr(176),1,-1,1)
cText=replace(cText,text,urllink,1,1,1)
loop
AutoURL=cText
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -