asp实现防止站外提交内容的两个方法
程序员文章站
2023-11-29 17:56:58
方式一: 复制代码 代码如下:<% function isselfrefer() dim form...
方式一:
方式二:
复制代码 代码如下:
<%
function isselfrefer()
dim formurl,relurl
formurl=lcase(trim(request.servervariables("http_referer")))
if formurl="" then
isselfrefer = false
else
relurl="http://" & trim(request.servervariables("server_name"))
if (formurl<>relurl) then
isselfrefer = false
else
isselfrefer = true
end if
end if
end function
%>
function isselfrefer()
dim formurl,relurl
formurl=lcase(trim(request.servervariables("http_referer")))
if formurl="" then
isselfrefer = false
else
relurl="http://" & trim(request.servervariables("server_name"))
if (formurl<>relurl) then
isselfrefer = false
else
isselfrefer = true
end if
end if
end function
%>
方式二:
复制代码 代码如下:
<%
function isselfrefer()
dim shttp_referer, sserver_name
shttp_referer = cstr(request.servervariables("http_referer"))
sserver_name = cstr(request.servervariables("server_name"))
if mid(shttp_referer, 8, len(sserver_name)) = sserver_name then
isselfrefer = true
else
isselfrefer = false
end if
end function
%>
function isselfrefer()
dim shttp_referer, sserver_name
shttp_referer = cstr(request.servervariables("http_referer"))
sserver_name = cstr(request.servervariables("server_name"))
if mid(shttp_referer, 8, len(sserver_name)) = sserver_name then
isselfrefer = true
else
isselfrefer = false
end if
end function
%>
上一篇: 基于mysql的bbs设计(三)
下一篇: 重庆八哥酸辣粉加盟费用及条件有哪些!