自己写的后台类中用来检测文件来源连接的程序部分

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

自己用的而已,见笑。

Class md_system_class

Private file_name_s,i,Come_url_s

'类初始化时的动作

Private Sub Class_Initialize()

If Not Response.IsClientConnected Then Response.End

End Sub

'类关闭时的操作

Private Sub Class_Terminate()

Response.End

End Sub

Public Sub Come_url(file_name)

file_name_s=split(file_name,",")

i=0

For i=0 To ubound(file_name_s)

If Request.ServerVariables("HTTP_REFERER")<>"http://"&Request.ServerVariables("SERVER_NAME")&Mid(Request.ServerVariables("SCRIPT_NAME"),1,InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))&Trim(file_name_s(i)) Then

Come_url_s=False

Else

Come_url_s=True

Exit For

End If

Next

If Come_url_s=False Then

Response.Write("<script language='javascript'>"&chr(13))

Response.Write("<!--"&chr(13))

Response.Write("function Index(){ window.alert('非法登陆页面');window.top.location='md_system_login.asp';}"&chr(13))

Response.Write("Index();"&chr(13))

Response.Write("-->"&chr(13))

Response.Write("</script>")

Response.End

End IF

End Sub

End Class

调用时:

Dim xxx

Set xxx=New md_system_class

Call xxx.Come_url(a.asp,b.asp)

Set xxx=nothing

括号中可以是无数个地址,用逗号隔开

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航