ASP只允许指定IP访问网站管理后台

7次阅读

  后台限制 IP 访问 只允许指定 IP 访问后台 黑客有后台帐号密码也没用     ' 下面的例子只允许 127.0.0.1 登陆后台 或者 10.110.8.8
    10.110.8.8 这个是管理员自己的远程 IP
    '限制指定 IP 断 黑客就算得到后台密码 也无法登陆
    adminIP=Request.ServerVariables("REMOTE_ADDR")
    if(left(adminIP,10)="110.8.8")or(adminIP="127.0.0.1")then
    '允许执行
    else
    Response.Write"<script language=javascript>alert('非指定 IP 段,不允许访问后台!\r\n 你可以到拉登哥哥 Blog 学习下');location.href='http://qqhack8.blog.163.com';</script>"
    response.end
    end if
    你也可以改成这样   只允许 127.0.0.1 访问 就是说只有在服务器上才能访问了
    adminIP=Request.ServerVariables("REMOTE_ADDR")
    if  adminIP="127.0.0.1" then
    '允许执行
    else
    Response.Write"<script language=javascript>alert('非指定 IP 段,不允许访问后台!\r\n 你可以到拉登哥哥 Blog 学习下');location.href='http://qqhack8.blog.163.com';</script>"
    response.end
    end if

正文完