本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>建站代码>>asp代码

asp用户验证登陆代码

  • asp用户验证登陆代码

    先是前台静态页面

    login.htm页面
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>登录管理</title>
    </head>
    <body>
    <p> </p>
    <form name="form1" method="post" action="loginnew.asp">
      <table width="200" border="1" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td colspan="2"><div align="center">登录</div></td>
        </tr>
        <tr> 
          <td width="57"><div align="center">用户名</div></td>
          <td width="137" valign="top"><input name="username" type="text" 
    id="username" size="25"></td>
        </tr>
        <tr> 
          <td><div align="center">密码</div></td>
          <td valign="top"><input name="password" type="password" 
    id="password" size="25"></td>
        </tr>
        <tr> 
          <td colspan="2"><div align="center"> 
              <input type="submit" name="Submit" value="提交">
            </div></td>
        </tr>
      </table>
    </form>
    </body>
    </html>

    后台页面
    loginnew.asp网页
    <%
    dim username,password
     
     username=request.form("username")
     password=request.form("password")
     set rs=server.createobject("adodb.recordset") 
     conn = "DBQ=" + server.mappath("huiyuan.mdb") + ";DefaultDir=;
    DRIVER={Microsoft Access Driver (*.mdb)};" 
     sql="select * from pUser213 where y_username='"&username&"'"
     rs.open sql,conn,1,1
     if rs.eof then
      response.write "<script>alert('登录失败');history.back();</script>"
      response.end
      else
        if rs("y_password")<>password then
          response.write "<script>alert('登录失败');history.back();</script>"
          response.end     
         end if      
         session("admin")=username
    response.write"<script>alert('登录成功');location.href='index.asp'</script>"
      end if
    %>

    在提示一下 。这段代码不具备安全行。没做任何安全处理!小戴


  • [时间:2008-12-17 13:50:24][点击:]

  • 上下篇文章加载中...
本站关键字:宁波网络公司/宁波网站建设公司/宁波网站制作公司/宁波做网站公司