⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resave.asp

📁 简单的BBS代码
💻 ASP
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="conn.asp" -->
<%
FUNCTION txtToURL(tekst)
Tekst_temp = tekst

Tekst_temp = Replace(Tekst_temp,"<","&lt;")
Tekst_temp = Replace(Tekst_temp,">","&gt;")

txtToURL = Tekst_temp
END FUNCTION

'--------------------读取数据----
name=request("name")
from=request("from")
subject=request("subject")
email=request("email")
id=request("id")
homepage=request("homepage")
oicq=request("oicq")
sex=request("sex")
note=request("note")
if from="" then from="远方的城市"
if oicq="" then oicq="000000"
if homepage="" or homepage="http://" then homepage="还没有!"
'------------------------------------------------------------
if trim(subject)="" then '-------------------------判断标题
        response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('请填入标题!');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
        response.end
end if        
'------------------------------------------------------------
if trim(name)="" then '--------------判断名字
		response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('请填入你的名字');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if
'------------------------------------------------------------
if trim(oicq)<>"" then '--------------判断OICQ
		if not(isnumeric(oicq)) then
		response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('"&name&", OICQ必须是数字.');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if
if len(oicq)<5 or len(oicq)>9 then
        response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('OICQ号码必须大于5小于9位!');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if
end if
'--------------------判断email函数----------
If email<>"" and IsValidEmail(email)=false then
	    response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('信箱地址错误!');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if
'----------------------------------------------
if trim(note)="" then '--------------判断内容
		response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('怎么可以没内容呢?');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if
'-------------------------------------------------
function IsValidEmail(email)'判断-------------------------
 dim names, name, i, c
 IsValidEmail = true
 names = Split(email, "@") '-----------判断有否@-------------------
 if UBound(names) <> 1 then '---------无---------
   IsValidEmail = false
   exit function
 end if
 for each name in names '分割的每段长度-----------------
   if Len(name) <= 0 then
     IsValidEmail = false
     exit function
   end if
   for i = 1 to Len(name)
     c = Lcase(Mid(name, i, 1)) '------------分割成每个字母或数字------------------
     if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name, 1) = "." or Right(name, 1) = "." then '---------------------
      IsValidEmail = false
      exit function
   end if
 next
 if InStr(names(1), ".") <= 0 then
   IsValidEmail = false
   exit function
 end if
 i = Len(names(1)) - InStrRev(names(1), ".") '---------------------------
 if i <> 2 and i <> 3 then
   IsValidEmail = false
   exit function
 end if
 if InStr(email, "..") > 0 then
   IsValidEmail = false
 end if

end function '------------------------函数结束

'----------------------------------------------------------------
Set rs= Server.CreateObject("ADODB.Recordset")
sql="update book set retimes=retimes+1 where id="&id&""
rs.open sql,conn,1,1
sql="update book set redate=now() where id="&id&""
rs.open sql,conn,1,1
sql="select * from book"
rs.open sql,conn,3,2
rs.addnew

		rs("n")=Server.HtmlEncode(name)
		rs("f")=Server.HtmlEncode(from)
		rs("e")=email
        rs("subject")=subject
        rs("reid")=id
		rs("h")=homepage
		rs("q")=Server.HtmlEncode(oicq)
		rs("note")=txtToURL(note)
		rs("s")=sex
		rs("t")=now()
		rs("ip")=Request.ServerVariables("REMOTE_HOST")
		rs.update
		rs.close
	    response.redirect "default.asp"
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -