本地可以登陆,传到服务器上却说验证码错误!!!
登陆页面:<html><head><title>管理员登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css.css" rel="stylesheet" type="text/css">
</head>
<body oncontextmenu=self.event.returnValue=false onselectstart="return false" leftmargin="0" topmargin="20" marginwidth="0" marginheight="0">
<TABLE WIDTH=420 BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center>
<TR>
<TD><IMG SRC="../images/login_admin1.jpg" WIDTH=420 HEIGHT=36></TD>
</TR>
<TR>
<TD><IMG SRC="../images/login_admin2.jpg" WIDTH=420 HEIGHT=106></TD>
</TR>
<TR>
<TD background="../images/login_admin3.jpg" WIDTH=420 HEIGHT=137>
<form name="admininfo" method="post" action="chkadmin.asp" >
<table width="300" border="0" align="center" cellpadding="2" cellspacing="1">
<tr>
<td width="75%">管理员帐号:
<input class="wenbenkuang" name="admin" type="text" id="admin" size="20">
</td>
<td width="35%" align="center">
<input class="go-wenbenkuang" name="imageField" value="管理登陆" type="submit" >
</td>
</tr>
<tr>
<td>管理员密码:
<input class="wenbenkuang" name="password" type="password" id="password" size="20">
</td>
<td align="center">
<input class="go-wenbenkuang" onClick="ClearReset()" type=reset name="Clear" value="清除重来">
</td>
</tr>
<tr>
<td>程序验证码:
<input class=wenbenkuang name=verifycode type=text value="<%If GetCode=9999 Then Response.Write "9999"%>" maxLength=4 size=10>
<img src=GetCode.asp></td>
<td align="center">
<input class="go-wenbenkuang" onClick="window.location='index.asp'" type=button value="返回首页" name=Submit3></td>
</tr>
</table>
</form></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/login_admin4.jpg" WIDTH=420 HEIGHT=51></TD>
</TR>
</TABLE>
</body>
</html>
验证码页面:
<%
Option Explicit
Response.buffer=true
NumCode
Function NumCode()
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
dim zNum,i,j
dim Ados,Ados1
Randomize timer
zNum = cint(8999*Rnd+1000)
Session("GetCode") = zNum
dim zimg(4),NStr
NStr=cstr(zNum)
For i=0 to 3
zimg(i)=cint(mid(NStr,i+1,1))
Next
dim Pos
set Ados=Server.CreateObject("Adodb.Stream")
Ados.Mode=3
Ados.Type=1
Ados.Open
set Ados1=Server.CreateObject("Adodb.Stream")
Ados1.Mode=3
Ados1.Type=1
Ados1.Open
Ados.LoadFromFile(Server.mappath("images/body.Fix"))
Ados1.write Ados.read(1280)
for i=0 to 3
Ados.Position=(9-zimg(i))*320
Ados1.Position=i*320
Ados1.write ados.read(320)
next
Ados.LoadFromFile(Server.mappath("images/head.fix"))
Pos=lenb(Ados.read())
Ados.Position=Pos
for i=0 to 9 step 1
for j=0 to 3
Ados1.Position=i*32+j*320
Ados.Position=Pos+30*j+i*120
Ados.write ados1.read(30)
next
next
Response.ContentType = "image/BMP"
Ados.Position=0
Response.BinaryWrite Ados.read()
Ados.Close:set Ados=nothing
Ados1.Close:set Ados1=nothing
End Function
%>
验证页面:
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%dim admin,password,verifycode
admin=replace(trim(request("admin")),"'","")
password=md5(replace(trim(request("password")),"'",""))
verifycode=replace(trim(request("verifycode")),"'","")
if admin="" or password="" then
response.Write "<script LANGUAGE='javascript'>alert('您的管理ID或密码有误!');history.go(-1);</script>"
response.end
end if
if cstr(session("GetCode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_admin where admin='"&admin&"' and password='"&password&"' " ,conn,1,1
if not(rs.bof and rs.eof) then
if password=rs("password") then
session("shopv8admin")=trim(rs("admin"))
session("flag")=int(rs("flag"))
session.Timeout=20
rs.Close
set rs=nothing
response.Redirect "index.asp"
else
response.write "<script LANGUAGE='javascript'>alert('对不起,登陆失败!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起,登陆失败!');history.go(-1);</script>"
end if
%>