回 帖 发 新 帖 刷新版面

主题:帮忙找错跪谢了

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>内部人员登陆系统</title>
<style type="text/css">
<!--
body {
    background-color: #990000;
    margin-top: 0px;
}
.STYLE1 {
    font-size: 24px;
    font-weight: bold;
    font-family: "新宋体";
    color: #FFCC99;
}
.STYLE2 {font-size: 12px}
.STYLE3{color: #990000; font-size: 12px; }
.STYLE5 {color: #33CCCC}
-->
</style>

<script language="javascript">
function yan()
{
        var usernumber=document.login.usernumber.value;
        if(document.login.usernumber.value=="")
        {
        window.alert("帐号输入不正确,请重新输入!");
        document.login.usernumber.focus();
        return false;
        }
        if(document.login.usernumber.value.length !=19)
        {
        window.alert("输入的帐号位数不正确,请重新输入!");
        document.login.usernumber.focus();
        return false;
        }
        if(isNaN(document.login.usernumber.value))
        {
        window.alert("帐号必须全是数字、请重新输入!");
        document.login.usernumber.focus();
        return false;
        }
        var username=document.login.username.value;
        if(document.login.username.value=="")
        {
        window.alert("用户名不能为空、请重新输入!");
        document.login.username.focus();
        return false;
        }
        var password=document.login.password.value;
        if(document.login.password.value=="")
        {
        window.alert("密码不能为空、请重新输入!");
        document.login.password.focus();
        return false;
        }
        if(document.login.password.value.length < 6 || document.login.apssword.value.length > 20)
        {
        window.alert("密码位数不正确、请重新输入!");
        document.login.password.focus();
        return false;
        }
        var rectify=document.login.rectify.value;
        if(document.login.rectify.value=="")
        {
        window.alert("管理验证码不能为空、请重新输入!");
        document.login.rectify.focus();
        return false;
        }
}
</script>

</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><form id="login" name="login"  onsubmit="return yan()" method="post" action="admin_loging.asp?action=yes">
      <table width="304" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4" align="center" valign="bottom" class="STYLE1">内部高级管理员登陆系统</td>
          </tr>
        <tr>
          <td width="66" align="center" valign="middle" class="STYLE2">高级管理员</td>
          <td colspan="2" align="left" valign="middle"><label>
            <input name=usernumber class="STYLE3" style="WIDTH: 140px; HEIGHT: 12px" 
            size="11" maxlength="20" onMouseOver="this.style.background='#E1F4EE'"; onMouseOut="this.style.background='#33CCCC'" onFocus="this.select(); ">
          </label></td>
          <td width="93">&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="middle" class="STYLE2">用&nbsp;&nbsp;户&nbsp;&nbsp;名</td>
          <td colspan="2" align="left" valign="middle"><label>
            <input name=username type="rext" class="STYLE3" style="WIDTH: 140px; HEIGHT: 12px" 
            size="11" maxlength="20" onmouseover="this.style.background='#E1F4EE'"; onmouseout="this.style.background='#33CCCC'" onfocus="this.select(); " />
          </label></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="middle" class="STYLE2">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</td>
          <td colspan="2" align="left" valign="middle"><label>
            <input name=password type="password" class="STYLE3" style="WIDTH: 140px; HEIGHT: 12px" 
            size="11" maxlength="20" onMouseOver="this.style.background='#E1F4EE'"; onMouseOut="this.style.background='#33CCCC'" onFocus="this.select(); " >
          </label></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="middle" class="STYLE2">验&nbsp;&nbsp;正&nbsp;&nbsp;码</td>
          <td align="left" valign="middle"><label>
            <input name="rectify" type="text" class="STYLE3" style="WIDTH: 50px; HEIGHT: 12px" 
            size="11" maxlength="20" onMouseOver="this.style.background='#E1F4EE'"; onMouseOut="this.style.background='#33CCCC'" onFocus="this.select(); " >
          </label></td>
          <td align="left" valign="middle"><img src="../inc/checkcode.asp"></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle">&nbsp;</td>
          <td width="66" align="left" valign="middle"><label>
          <input name="Submit" type="submit" class="STYLE3" style="WIDTH: 50px; HEIGHT: 18px;" onMouseOver="this.style.background='#E1F4EE'"; onMouseOut="this.style.background='#33CCCC'" value="(提*交)" />
          </label></td>
          <td width="79" align="right" valign="middle"><input name="Submit1" type="reset" class="STYLE3" style="WIDTH: 50px; HEIGHT: 18px;" onMouseOver="this.style.background='#E1F4EE'"; onMouseOut="this.style.background='#33CCCC'" value="(重*填)" /></td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <label></label>
    </form>    </td>
  </tr>
</table>
<p class="STYLE5">&nbsp;</p>
</body>
</html>


   注:这是页面一

回复列表 (共9个回复)

沙发

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
dim sql,rs
dim usernumber,username,password,rectify
usernumber=replace(trim(request("usernumber")),"'","")
username=replace(trim(request("username")),"'","")
password=replace(trim(Request("password")),"'","")
rectify=replace(trim(Request("rectify")),"'","")
if usernumber="" then
   FoundErr=True
   ErrMsg=ErrMsg & "<br><li>账号不能为空!</li>"
end if
if username="" then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>用户名不能为空!</li>"
end if
if password="" then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>密码不能为空!</li>"
end if
if rectify="" then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>验证码不能为空!</li>"
end if
if session("rectify")="" then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>你登录时间过长,请重新返回登录页面进行登录。</li>"
end if
if rectify <> CStr(session("rectify")) then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>您输入的确认码和系统产生的不一致,请重新输入。</li>"
end if
if FoundErr<>True then
    password=md5(password)
    set rs=server.createobject("adodb.recordset")
    sql="select * from admin where usernumber='"&usernumber&"' and password='"&password&"' and username='"&username&"'"
    rs.open sql,conn,1,3
    if rs.bof and rs.eof then
        FoundErr=True
        ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>"
    else
        if password<>rs("password") then
            FoundErr=True
            ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>"
        else
            RndPassword=GetRndPassword(16)
            rs("LastLoginIP")=Request.ServerVariables("REMOTE_ADDR")
            rs("LastLoginTime")=now()
            rs("LoginTimes")=rs("LoginTimes")+1
            rs("RndPassword")=RndPassword
            rs.update
            session.Timeout=SessionTimeout
            session("AdminName")=rs("username")
            session("AdminPassword")=rs("Password")        
            session("RndPassword")=RndPassword
            rs.close
            set rs=nothing
            call CloseConn()
            Response.Redirect "default.asp"
        end if
    end if
    rs.close
    set rs=nothing
end if
if FoundErr=True then
    call WriteErrMsg()
end if
call CloseConn()

'****************************************************
'过程名:WriteErrMsg
'作  用:显示错误提示信息
'参  数:无
'****************************************************
sub WriteErrMsg()
    dim strErr
    strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
    strErr=strErr & "<link href='style.css' rel='stylesheet' type='text/css'></head><body>" & vbcrlf
    strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
    strErr=strErr & "  <tr align='center'><td height='22' class='title'><strong>错误信息</strong></td></tr>" & vbcrlf
    strErr=strErr & "  <tr><td height='100' class='tdbg' valign='top'><b>产生错误的可能原因:</b><br>" & errmsg &"</td></tr>" & vbcrlf
    strErr=strErr & "  <tr align='center'><td class='tdbg'><a href='admin_index.asp'>&lt;&lt; 返回登录页面</a></td></tr>" & vbcrlf
    strErr=strErr & "</table>" & vbcrlf
    strErr=strErr & "</body></html>" & vbcrlf
    response.write strErr
end sub

Function GetRndPassword(PasswordLen)
    Dim Ran,i,strPassword
    strPassword=""
    For i=1 To PasswordLen
        Randomize
        Ran = CInt(Rnd * 2)
        Randomize
        If Ran = 0 Then
            Ran = CInt(Rnd * 25) + 97
            strPassword =strPassword & UCase(Chr(Ran))
        ElseIf Ran = 1 Then
            Ran = CInt(Rnd * 9)
            strPassword = strPassword & Ran
        ElseIf Ran = 2 Then
            Ran = CInt(Rnd * 25) + 97
            strPassword =strPassword & Chr(Ran)
        End If
    Next
    GetRndPassword=strPassword
End Function
%>

板凳

出什么问题?

3 楼

<这里是页面二   上一个是index.asp 这个是login.asp>

从index.asp到login.asp出错 我的数据库里只有ID 、usernumber、username、password、四个字段请问那里错了高个指点一下   

       错误信息 
   产生错误的可能原因:


   你登录时间过长,请重新返回登录页面进行登录。

   您输入的确认码和系统产生的不一致,请重新输入 

   还有就是验正码不能有效的验正在index.asp里也是就第一下页面

请问怎么改一下?

急等指点谢谢了

4 楼

if usernumber="" then
   FoundErr=True
   ErrMsg=ErrMsg & "<br><li>账号不能为空!</li>"
   response.write "<script>alert('"&errmsg&"');history.back();</script>"
   response.end         '每个都加上这两句
end if

5 楼

出来下个空白页面

没有任何提示呀 该 去的页面也没有去????倒?

6 楼


点击很高可是没有一个能给找点错呀

郁闷中

7 楼

在第二个页面用Response.Write(session("rectify")):Respone.End放在第一句看看有没输出东西来。。。可能是你的验证码为空。。所以才会出现以上两种错误提示。。

8 楼

我自己再顶一下

9 楼

你用Response.write把所有的变量都显示看一下。。能不能把第一页的变量传送到第二页。。这个很简单的。你慢慢调一下就可以了。

我来回复

您尚未登录,请登录后再回复。点此登录或注册