| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 305 人关注过本帖
标题:asp 不能连进数据库
只看楼主 加入收藏
撒布拉斯
Rank: 2
等 级:论坛游民
帖 子:35
专家分:12
注 册:2011-3-2
结帖率:92.86%
收藏
已结贴  问题点数:2 回复次数:1 
asp 不能连进数据库
<!--#include file="con_db.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网站后台管理</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>

<body background="../image/forgetpw/password.jpg">
<div><form action="login.asp" method="post" onClick="">
  <center>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="385" height="102" border="0" cellpadding="0" cellspacing="0"  bgcolor="#CCCCCC">
        <tr>
                <td width="110"><span class="STYLE1">登录界面</span></td>
                <td width="275">&nbsp;</td>
        </tr>
        <tr>
                <td><span class="STYLE1">用户:</span></td>
                <td><input type="text" name="UserName"></td>
        </tr>
        <tr>
                <td><span class="STYLE1">密码:</span></td>
                <td><input type="password" name="pwd">
                </td>
        </tr>
        <tr>
                <td><span class="STYLE1">权限:</span></td>
                <td><input name="radiobutton" type="radio" value="radiobutton" checked>
                        管理员
                                <input type="radio" name="radiobutton" value="radiobutton">
                                工作人员</td>
        </tr>
    </table>
      <input type="reset" name="Submit2" value="重置">   
      <input type="submit" name="Submit" value="提交">
  </center>
</form></div>
</body>
</html>

<%
  UserName=Trim(Request("UserName"))
  pwd=Trim(Request("pwd"))
  if user<>"" and pwd<>"" then
  Set LoginRS = Server.CreateObject("ADODB.RecordSet")
  SqlStr = "select * from admin where name='" & UserName & "'"
  LoginRS.Open SqlStr,Conn,1,3
  If LoginRS.EOF AND LoginRS.BOF Then
        response.write"<script language=JavaScript>alert('登录失败:\n\n您输入了错误的帐号,请再次输入!');"   
        response.write"this.location.href='Login.asp';</script>"
        Response.End
  Else
    IF LoginRS("PassWord")=pwd THEN
       IF Cint(LoginRS("Locked"))=1 Then
            response.write"<script language=JavaScript>alert('登录失败:\n\n您的账号已被管理员锁定,请与您的系统管理员联系!');"
            response.write"this.location.href='Login.asp';</script>"
              Response.End
       else
            LoginRS("LastTime")=Now()
            LoginRS("LastLoginIP")=userip
            LoginRS("num")=LoginRS("num")+1
            LoginRS.UpDate
            
            Response.Cookies("job_admin_Name")=LoginRS("admin")
            Response.Cookies("job_admin_PassWord")=LoginRS("PassWord")
            Response.Cookies("job_admin_flag")=LoginRS("flag")
            
            Response.Cookies("job_admin_Name").expires=(now()+1/24)
            Response.Cookies("job_admin_PassWord").expires=(now()+1/24)
            Response.Cookies("job_admin_flag").expires=(now()+1/24)
            
            Response.Redirect("Admin_Index.asp")
            Response.end
            End IF   
    else
         response.write"<script language=JavaScript>alert('登录失败:\n\n您的密码错误,请您重新输入!');"
        response.write"this.location.href='Login.asp';</script>"
        Response.End   
     end if
   end if
  else
   response.write"<script language=JavaScript>alert('登录失败:\n\n用户密码不能为空,请您重新输入!');"
   Response.End
  end if   
%>
程序代码:
<!--#include file="con_db.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网站后台管理</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>

<body background="../image/forgetpw/password.jpg">
<div><form action="login.asp" method="post" onClick="">
  <center>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="385" height="102" border="0" cellpadding="0" cellspacing="0"  bgcolor="#CCCCCC">
        <tr>
                <td width="110"><span class="STYLE1">登录界面</span></td>
                <td width="275">&nbsp;</td>
        </tr>
        <tr>
                <td><span class="STYLE1">用户:</span></td>
                <td><input type="text" name="UserName"></td>
        </tr>
        <tr>
                <td><span class="STYLE1">密码:</span></td>
                <td><input type="password" name="pwd">
                </td>
        </tr>
        <tr>
                <td><span class="STYLE1">权限:</span></td>
                <td><input name="radiobutton" type="radio" value="radiobutton" checked>
                        管理员
                                <input type="radio" name="radiobutton" value="radiobutton">
                                工作人员</td>
        </tr>
    </table>
      <input type="reset" name="Submit2" value="重置">   
      <input type="submit" name="Submit" value="提交">
  </center>
</form></div>
</body>
</html>

<%
  UserName=Trim(Request("UserName"))
  pwd=Trim(Request("pwd"))
  if user<>"" and pwd<>"" then
  Set LoginRS = Server.CreateObject("ADODB.RecordSet")
  SqlStr = "select * from admin where name='" & UserName & "'"
  LoginRS.Open SqlStr,Conn,1,3
  If LoginRS.EOF AND LoginRS.BOF Then
        response.write"<script language=JavaScript>alert('登录失败:\n\n您输入了错误的帐号,请再次输入!');"   
        response.write"this.location.href='Login.asp';</script>"
        Response.End
  Else
    IF LoginRS("PassWord")=pwd THEN
       IF Cint(LoginRS("Locked"))=1 Then
            response.write"<script language=JavaScript>alert('登录失败:\n\n您的账号已被管理员锁定,请与您的系统管理员联系!');"
            response.write"this.location.href='Login.asp';</script>"
              Response.End
       else
            LoginRS("LastTime")=Now()
            LoginRS("LastLoginIP")=userip
            LoginRS("num")=LoginRS("num")+1
            LoginRS.UpDate
           
            Response.Cookies("job_admin_Name")=LoginRS("admin")
            Response.Cookies("job_admin_PassWord")=LoginRS("PassWord")
            Response.Cookies("job_admin_flag")=LoginRS("flag")
           
            Response.Cookies("job_admin_Name").expires=(now()+1/24)
            Response.Cookies("job_admin_PassWord").expires=(now()+1/24)
            Response.Cookies("job_admin_flag").expires=(now()+1/24)
           
            Response.Redirect("Admin_Index.asp")
            Response.end
            End IF   
    else
         response.write"<script language=JavaScript>alert('登录失败:\n\n您的密码错误,请您重新输入!');"
        response.write"this.location.href='Login.asp';</script>"
        Response.End   
     end if
   end if
  else
   response.write"<script language=JavaScript>alert('登录失败:\n\n用户密码不能为空,请您重新输入!');"
   Response.End
  end if   
%>















































2011-03-23 11:26
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:2 
你要问的话,请先注明错误代码和提示,是哪一行错误。
你这样直接上一大堆代码,没人能帮你的。

----我怎能在别人的苦难面前转过脸去----
2011-03-23 12:41
快速回复:asp 不能连进数据库
数据加载中...
 
   



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

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