您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> asp >> 正文

用ASP+SQL Server为网页建一道防火墙

作者:佚名    信息学院来源:整理    点击数:    更新时间:2008-1-24 我要参与讨论

  content="Microsoft FrontPage Express 2.0"〉

  〈title〉firewall.asp〈/title〉

  〈/head〉

  〈body background="#800080 "〉

  〈%

  '使用Request.ServerVariables("REMOTE_ADDR")得到IP地址并保存在变量remoteip中

  remoteip=Request.ServerVariables("REMOTE_ADDR")

  stip=cstr(remoteip)

  '取得IP地址第三个段的值并保存到stip中

  for i=1 to 2

  stip=right(stip,len(stip)-instr(1,stip,"."))

  next

  stip=left(stip,instr(1,stip,".")-1)

  'IP地址有效性检验及密码验证,包括两方面的内容:如果IP地址符合则通过验证;如果IP地址不符合则检验输入的用户名、密码是否正确

  if (left(remoteip,5) 〈〉 "10.61" or stip〈"96" or stip〉"97") then

  username=request.form("t1")

  password=request.form("t2")

  Set fs = CreateObject("Scripting.FileSystemObject")

  Set thisfile = fs.OpenTextFile("dsn.txt")

  db_loc=thisfile.readline

  thisfile.close

  cnstr=db_loc&&"uid="&&username&&";"&&"pid="&&password

  on error resume   next

  set cn=server.createobject("adodb.connection")

  cn.open cnstr

  if err=3709 then %〉  

  〈p〉〈font color="#FF0000"〉对不起,用户:〈%=username%〉没有访问权限,或密码不正确! 〈BR〉〈/font〉〈/p〉

  〈form method="POST&q

上一页  [1] [2] [3] 下一页

在google里搜索更多用ASP+SQL Server为网页建一道防火墙

Google
Web www.51ec.org
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
我来说两句 对此文章发表了评论
  昵 称: *必填    ·注册用户·
  评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
评 论
内 容

 
评论列表 (最新 评论仅限网友观点!)

供求信息




| 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明