欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>网站制作技术>>文章内容
自己写的后台类中用来检测文件来源连接的程序部分
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

自己用的而已,见笑。

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")<>"("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

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


附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步