自己用的而已,见笑。
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
括号中可以是无数个地址,用逗号隔开