| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 660 人关注过本帖
标题:没办法进行登录操作,帮忙看看哪里错了
取消只看楼主 加入收藏
陈休
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-3-14
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
没办法进行登录操作,帮忙看看哪里错了
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.buffer=true%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录系统</title>
<style type="text/css">
<!--
#xiaohui
   {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 365px;
    top: 20px;
     }
.STYLE14
    {
    font-size: 24px
    }
#wenzi
    {
    position:absolute;
    width:269px;
    height:100px;
    z-index:2;
    left: 559px;
    top: 88px;
    }
.STYLE15
   {
    color: #0000FF;
    font-weight: bold;
    font-style: italic;
    }
#chatu
   {
    position:absolute;
    width:200px;
    height:115px;
    z-index:3;
    left: 97px;
    top: 208px;
   }
#biaodan {
    position:absolute;
    width:300px;
    height:206px;
    z-index:4;
    left: 816px;
    top: 374px;
    background-color: #FFFFFF;
}
.STYLE37 {
    font-size: 18px;
    font-style: italic;
    font-weight: bold;
}
.STYLE38 {color: #0000FF}
.STYLE39 {font-size: 12px}
.STYLE40 {color: #0000FF; font-size: 12px; }

-->
</style>
<script language="JAVASCRIPT" >
    <!--
    function check_Null(){
        if (document.form1.username.value==""){
            alert("用户名不能为空!");
            return false;
        }
        if (document.form1.pwd.value==""){
            alert("密码不能为空!");
            return false;
        }
        return true;
    }
    // -->
    </script>
   
</head>

<body>

<div id="xiaohui">
  <p><img src="../xiaohui.png" width="371" height="67"><span class="STYLE14"></span></p>
</div>
<div id="chatu"><img src="../chatu.jpg" width="640" height="427"></div>
<div class="STYLE14" id="wenzi"><span class="STYLE15">电子元器件管理系统</span></div>




<div id="biaodan">
  <form name="form1" onSubmit="javascript:return check_Null();" action=" " method=POST>
    <table width="291" border="1" bordercolor="#FFFFFF">
      <tr>
        <td colspan="2" bordercolor="#FFFFFF"><div align="center"><span class="STYLE37"><span class="STYLE38">用户登录/</span>LOGIN</span></div></td>
      </tr>
      <tr>
        <td colspan="2" bordercolor="#FFFFFF">&nbsp;</td>
      </tr>
      <tr>
        <td width="134" bordercolor="#FFFFFF"><div align="right"><span class="STYLE38"><span class="STYLE39"><img src="../yonghu.png" width="13" height="15">用户名</span></span></div></td>
        <td width="141" bordercolor="#FFFFFF"><label>
          <INPUT size=15 name="username" class="inputbox">
        </label></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF"><div align="right"><span class="STYLE38"><span class="STYLE39"><img src="../mima.png" width="15" height="18">密码</span></span></div></td>
        <td bordercolor="#FFFFFF"><label>
          <INPUT type=password size=15 name="pwd" class="inputbox">
        </label></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF"><div align="right"><span class="STYLE40">用户类型</span></div></td>
        <td bordercolor="#FFFFFF"><label>
          <input type="radio" name="usertype" value="2">
          <span class="STYLE40"> 老师&nbsp;</span>
        <span class="STYLE39"><input name="usertype" type="radio" value="1" checked>
        <span class="STYLE38">        学生</span></span></label></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF"><label>
        </label>
        <label>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       &nbsp;&nbsp;
       <input type=submit value="登录" name=submit  class="inputbutton">
        </label></td>
        <td bordercolor="#FFFFFF"><label>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" value="注册" name="loginbutton" class="inputbutton" OnClick="window.open('/kill/register/reg.asp','_self')">
        </label></td>
      </tr>
    </table>  
  </form>
<%
set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Dbq="&Server.Mappath("sky.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"

dim username,pwd
username=replace(trim(request("username")),"'","")
pwd=replace(trim(Request("pwd")),"'","")
usertype=replace(trim(Request("usertype")),"'","")

if username<>"" then'查有无该用户
    if usertype="1" then
        sql="select * FROM stu_table Where sno='" & username & "' And spwd='" & pwd & "'"
    elseif usertype="2" then
        sql="select * FROM tea_table Where tno='" & username & "' And tpwd='" & pwd & "'"
    end if

    Set rs=Conn.Execute(sql)
    If Not rs.Bof And Not rs.Eof Then'登录成功
        session("usertype")=usertype
        if usertype=1 then
            session("username")=rs("sno")
            response.redirect "/kill/inquiry/inquiry.asp"
        else
            session("username")=rs("tno")
            response.redirect "/kill/inquiry/teacher.asp"
        end if
    Else
        response.write "对不起,用户名或密码有误,请重新登录"
    End If
   
end if
%>
</div>
</body>
</html>
没办法连接数据库进行登录操作,请高手帮忙看看

[ 本帖最后由 陈休 于 2010-4-14 16:20 编辑 ]
搜索更多相关主题的帖子: html head absolute position content 
2010-04-14 16:19
陈休
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-3-14
收藏
得分:0 
回复 2楼 孤独冷雨
Dim Conn
set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Dbq="&Server.Mappath("sky.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"
改成这一段也没用啊,还是没办法登录
2010-04-15 18:54
陈休
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-3-14
收藏
得分:0 
回复 5楼 aspic
貌似并不是这里的问题,因为我手里另一个系统没这几句代码登录是没问题的
2010-04-17 20:20
快速回复:没办法进行登录操作,帮忙看看哪里错了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052204 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved