在线情况
楼主
  • 头像
  • 级别
    • 积分231
    • 经验6320
    • 文章173
    • 注册2004-12-02
    如何在下列代码中加入权限分配????在线急等!!!!!
    <!--#include file="conn.asp"-->

    <%
    if Session("admin")<>"admin" then
    %>
    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>管理登录</title>

    <style>
    <!--
    body         { font-family: 宋体; font-size: 9pt; color: #000000; text-decoration: none }
    table        { font-family: 宋体; font-size: 9pt; color: #000000; text-decoration: none }
    a:link       { font-family: 宋体; font-size: 9pt; text-decoration: none; color: #000000 }
    a:active     { font-family: 宋体; font-size: 9pt; text-decoration: none }
    a:visited    { font-family: 宋体; font-size: 9pt; text-decoration: none }
    a:hover      { font-family: 宋体; font-size: 9pt; color: #FF0000; text-decoration: none }
    a            { color: #000000; font-family: 宋体; font-size: 9pt; text-decoration: none }
    a.mecl                  {COLOR: #000000; font-size:9pt; font-family:宋体; text-decoration:none}
    a:visited.mecl            {COLOR: #000000;TOP: 1px; TEXT-DECORATION: none; font-family:宋体; font-size:9pt}
    a:hover.mecl            {COLOR: #FF0000;position: relative; top: 1px; TEXT-DECORATION: none; font-family:宋体; font-size:9pt}
    -->
    </style>
    </head>

    <body bgcolor="#6B96B4" leftmargin="0" topmargin="0">

    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778">
        <tr>
          <td width="100%">
          <div align="center">
            <center>
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" bgcolor="#FFFFFF" height="349">
              <tr>
                <td width="100%" height="293">
                <div align="center">
                  <center>
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="40%">
                  <form name="form1" method="POST">
                    <tr>
                      <td width="100%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" colspan="2" height="30" bgcolor="#DAE6ED">
                      <p align="center">管理员登陆</td>
                    </tr>
                    <tr>
                      <td width="33%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="30" align="center">
                      用户名</td>
                      <td width="67%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="30">
                      <input type="text" name="name" size="20" style="border: 1px groove #C0C0C0; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>
                    </tr>
                    <tr>
                      <td width="33%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="30" align="center">
                      密  码</td>
                      <td width="67%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="30">
                      <input type="password" name="pass" size="20" style="border: 1px groove #C0C0C0"></td>
                    </tr>
                    <tr>
                      <td width="100%" style="border: 1px solid #6B96B4; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="30" colspan="2">
                      <p align="center">
                      <input type="submit" value="提交" name="B1" style="border: 1px solid #000000; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF"></td>
                    </tr>
                    </form>
                  </table>
                  </center>
                </div>
                </td>
              </tr>
              <tr>
                <td width="100%" height="16"> </td>
              </tr>
              <tr>
                <td width="100%" height="40"> </td>
              </tr>
            </table>
            </center>
          </div>
          </td>
        </tr>
      </table>
      </center>
    </div>
    </body>

    </html>
    <%End if%>
    <%
      post=Request("post")
      name = Request("name")
      name = Replace(name,"'","")
      name = Replace(name," ","")
      pass = Request("pass")
      pass = Replace(pass,"'","")
      pass = Replace(pass," ","")
     
      if name<>"" and pass="" then Response.Write("<script>alert('密码不能为空');history.go(-1)</script>")
      if name="" and pass<>"" then Response.Write("<script>alert('用户名不能为空');history.go(-1)</script>")
      if name<>"" and pass<>"" then
      set rs=server.createobject("adodb.recordset")
      rs.open "select * from admin where name='"&name&"' and pass='"&pass&"' ",conn,1,3
      if rs.Eof or rs.Bof then
      Session("admin")=""
      Response.Write("<script>alert('你的用户名或密码错误');history.go(-1)</script>")
      Response.End
      rs.close              
      set rs=nothing
      Else
      Session("admin")="admin"
       Response.Write("<script>window.location=('admin1.asp')</script>")
     End if

    End if
    %>
    <%
     if post="quit" then
     Session("admin")=""
     Response.Write("<script>alert('你已经成功退出!');window.location=('admin.asp')</script>")
     End if
    %>
    asp技术学习感谢您的参与
    在线情况
    2
    • 头像
    • 级别
      • 积分720
      • 经验7378
      • 文章656
      • 注册2004-11-26
      这么长
      asp技术学习感谢您的参与
      Page created in 0.0156 seconds with 4 queries.