asp实现防止站外提交内容的两个方法
程序员文章站
2023-10-20 14:27:50
方式一: 复制代码 代码如下:<% 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
%>
上一篇: 冬天吃什么菜好?吃对才重要!