如题,不管怎么输入都是验证码错误。求大侠指点。
登陆页面:
<!--#include file = admin_conn.asp -->
<html>
<!--#include file = language.asp -->
<head>
<title>蓝网网站后台登录</title>
<STYLE type="text/css">
<!--
a:link {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited {text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;table-layout:fixed;word-break:break-all}
p {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select {FONT-SIZE: 9PT;}
option {FONT-SIZE: 9pt;}
textarea {FONT-SIZE: 9pt;}
.STYLE1 {color: #FFFFFF}
-->
</STYLE>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.user.value == "")
{
alert("请在 用户名 域中输入值。");
theForm.user.focus();
return (false);
}
if (theForm.user.value.length < 2)
{
alert("在 用户名 域中,请至少输入 2 个字符。");
theForm.user.focus();
return (false);
}
if (theForm.user.value.length > 20)
{
alert("在 用户名 域中,请最多输入 20 个字符。");
theForm.user.focus();
return (false);
}
if (theForm.pass.value == "")
{
alert("请在 密码 域中输入值。");
theForm.pass.focus();
return (false);
}
if (theForm.pass.value.length < 1)
{
alert("在 密码 域中,请至少输入 1 个字符。");
theForm.pass.focus();
return (false);
}
if (theForm.pass.value.length > 20)
{
alert("在 密码 域中,请最多输入 20 个字符。");
theForm.pass.focus();
return (false);
}
if (theForm.XuasYzm.value == "")
{
alert("请在 验证码 域中输入值。");
theForm.XuasYzm.focus();
return (false);
}
if (theForm.XuasYzm.value.length < 4)
{
alert("在 验证码 域中,请至少输入 4 个字符。");
theForm.XuasYzm.focus();
return (false);
}
if (theForm.XuasYzm.value.length > 4)
{
alert("在 验证码 域中,请最多输入 4 个字符。");
theForm.XuasYzm.focus();
return (false);
}
var checkOK = "0123456789-";
var checkStr = theForm.XuasYzm.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("在 验证码 域中,只能输入 数字 字符。");
theForm.XuasYzm.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="admin_login.asp" target=_top onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" id="table9" >
<tr>
<td style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" background="img/admin_login.jpg" width="563" height="364" id="table10">
<tr>
<td valign="top" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<div align="center">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table11">
<tr>
<td width="207" height="130" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td height="130" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> <%
if request("id")="0" then response.write "请填写完整!"
if request("id")="1" then response.write "用户名或密码错误!"
if request("id")="3" then response.write "验证码错误"
if request("id")="8" then response.write "网络超时,或未登录。请重新登录!"
if request("id")="9" then response.write "正常退出后台管理系统"
%> </td>
<td width="37" height="130" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
</tr>
<tr>
<td width="207" height="111" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td height="111" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<table border="0" cellpadding="5" cellspacing="0" width="319" id="table12">
<tr>
<td width="114" align="center" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
用户名</td>
<td width="205" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<%
sql = "select * from admin"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
%>
<!--webbot bot="Validation" s-display-name="用户名" b-value-required="TRUE" i-minimum-length="2" i-maximum-length="20"><input type="text" name="user" size="24" maxlength="20" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000" --><select name="user" id="user">
<option value="">--- 请选择您的身份 ---</option>
<%do while not rs.eof%>
<option value="<%=rs("user")%>"><%=rs("user")%></option>
<%
rs.movenext
loop
%>
</select></td>
</tr>
<tr>
<td width="114" align="center" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
密 码</td>
<td width="205" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<!--webbot bot="Validation" s-display-name="密码" b-value-required="TRUE" i-minimum-length="5" i-maximum-length="20" --><input type="password" name="pass" size="24" maxlength="20" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000"></td>
</tr>
<tr>
<td width="114" align="center" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
验证码</td>
<td width="205" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<!--webbot bot="Validation" s-display-name="验证码" s-data-type="Integer" s-number-separators="x" b-value-required="TRUE" i-minimum-length="5" i-maximum-length="5" --><input name="XuasYzm" size="9" maxlength="5" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000">
<%
Randomize
an=""
an= int((9999-1111+1) * RND +1111)
session("xuasyzm")=an
Response.Write an
%> </td>
</tr>
</table> </td>
<td width="37" height="111" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
</tr>
<tr>
<td width="207" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td width="37" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
</tr>
<tr>
<td width="207" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all">
<p align="center">
<input type="image" src=img/login001.jpg value="提交" name="B1">
<a href="#" onClick="window.opener=null;window.close()" style="text-decoration: none; font-family: AdobeSm; color: #000000">
<img border="0" src="img/login002.jpg" width="72" height="21"></a></td>
<td width="37" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
</tr>
<tr>
<td width="207" height="56" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td height="56" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
<td width="37" height="56" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> </td>
</tr>
<tr>
<td colspan="3" style="font-size: 9pt; font-family: 宋体,MingLiU, Arial; color: #000000; table-layout: fixed; word-break: break-all"> <span class="STYLE1">现在的日期和时间:</span><span style="letter-spacing: -1pt"> <font color="#FFBEC6"><%=now()%></font></span> </td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%
conn.close
set conn=nothing
%>
判断,请求页面。
<!--#include file = admin_conn.asp -->
<!--#include file = md5.asp -->
<html>
<head>
<!--#include file = language.asp -->
<!--#include file = titleb.asp -->
<title>网站后台登录</title>
</head>
<body>
<%
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
Function finddir(filepath)
finddir=""
for i=1 to len(filepath)
if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
abc=i
exit for
end if
next
if abc <> 1 then
finddir=left(filepath,len(filepath)-abc+1)
end if
end Function
xuasyzm=int(trim(request("xuasyzm")))
if xuasyzm="" then
Response.Redirect "login.asp?id=3"
end if
if xuasyzm<>session("xuasyzm") then
Response.Redirect "login.asp?id=3"
end if
session("xuasyzm")=""
if request("user")="" or request("pass")="" then
conn.close
set conn=nothing
Response.Redirect "login.asp?id=0"
else
user=LCase(chkhtm(request("user")))
pass=md5(chkhtm(trim(request("pass"))))
sql = "select * from admin where [user]='"&user&"' and [pass]='"&pass&"'"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount=0 then
blog=user&"登录系统后台失败。IP是:"&userip&"。"
addtime=now()
conn.Execute "insert into [blog] ([content],[addtime]) values('"&blog&"','"&addtime&"')"
conn.close
set conn=nothing
Response.Redirect "login.asp?id=1"
end if
session("admin__user")=rs("user")
session("admin__pass")=trim(request("pass"))
session("dj")=rs("dj")
blog=rs("user")&"登录系统后台成功。IP是:"&userip&"。"
addtime=now()
conn.Execute "insert into [blog] ([content],[addtime]) values('"&blog&"','"&addtime&"')"
Response.Redirect "admin_index.asp"
end if
%>
</body>
</html>
<%
conn.close
set conn=nothing
%>
你把session("xuasyzm")跟你提交后获取到的xuasyzm都输出来看一下,看是哪儿的问题