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

📄 save.asp

📁 公文下发和上报管理:   在发布和上报文件时
💻 ASP
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="conn.asp" -->
<%
txtname=trim(request("txtname"))
txtemail=trim(request("txtemail"))
txthomepage=trim(request("txthomepage"))
txtoicq=trim(request("txtoicq"))
pic=request("txthead")
txtcome=trim(request("txtcome"))
sex=request("sex")
hip=cint(request("rcheck"))
if hip=1 then 
hip=1
else
hip=0
end if
txtcontent=trim(request("txtcontent"))
if txtoicq="" then txtoicq="保密"
if txtcome="" then txtcome="保密"
if txthomepage="" or txthomepage="http://" then txthomepage="保密"

if txtname="" 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 txtemail="" or IsValidEmail(txtemail)=false then
	    response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('email输入错误');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
end if

if txtcontent=""  then
	    response.write "<script language='javascript'>" & VbCRlf
	    response.write "alert('留言内容怎么能能空呢');" & VbCrlf
	    response.write "history.go(-1);" & vbCrlf
	    response.write "</script>" & VbCRLF
	    response.end
'else 
'response.write txtcontent
'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 
function IsLongStr(str) 
dim longStrs,longstr
IsLongStr = true
longStrs = Split(str,"")
for each longStr in longStrs
	if len(longstr) >50 then
	ISlongStr = false
	end if
next
end function


txtname=server.htmlencode(txtname)
txtcome=server.htmlencode(txtcome)
txtemail=server.htmlencode(txtemail)
txtcome=server.htmlencode(txtcome)
txthomepage=txthomepage
txtoicq=server.htmlencode(txtoicq)
txtcontent=server.htmlencode(txtcontent)
reply = "没有"

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from enet"
rs.open sql,conn,3,2
rs.addnew

		rs("name")=txtname
		rs("email")=txtemail
       	rs("homepage")=txthomepage
        rs("come")=txtcome
		rs("oicq")=txtoicq
		rs("content")=txtcontent
		rs("head")=pic
		rs("dateandtime")=now()
		rs("reply")=reply
		rs("ip")=Request.ServerVariables("REMOTE_HOST")
		rs("writename")=txt_writename
		rs("sex")=cstr(sex)
		rs("hip")=hip
		rs.update
		rs.close
		response.redirect "index.asp"
%>

⌨️ 快捷键说明

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