登入界面显示不了验证码

zgl13995510263 2009-11-10 07:29:11
这是我的userlogin.asp

<!--#include file="inc/function.asp" -->
<%if saferequest("action")="login" then
dim u_user,u_password,passcode
u_user=trim(request("u_user"))
u_password=md5(trim(request("u_password")))

if u_user="" or u_password="" then
response.write "<script LANGUAGE='javascript'>alert('用户名或密码不可以为空!');history.go(-1);</script>"
end if

if request("passcode")="" then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!验证码不可以为空!');history.go(-1);</script>"
end if

if not isnumeric(request("passcode")) then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!验证码必须是数字,请正确填写!');history.go(-1);</script>"
end if

passcode=cint(request("passcode"))

if passcode<>Session("GetCode") then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!验证码错误!');history.go(-1);</script>"
end if

set rsadmin=server.createobject("adodb.recordset")

sql="select * from hxt_user where u_user='"&u_user&"' and u_password='"&u_password&"'"

rsadmin.open sql,conn,1,3
if rsadmin.eof and rsadmin.bof then
response.write "<script LANGUAGE='javascript'>alert('登录名或密码错误,请重新输入!"&u_user&""&U_password&"');history.go(-1);</script>"
else
rsadmin("u_hit")=rsadmin("u_hit")+1
rsadmin("u_times")=now()
rsadmin.update
session("users")=true
session("user")=rsadmin("u_user")
session("hit")=rsadmin("u_hit")
session("time")=rsadmin("u_times")
session("name")=rsadmin("u_name")

if request("cook")=1 then
Response.Cookies("UserCookie")("User")=rsadmin("u_user")
Response.Cookies("UserCookie")("Password")=rsadmin("u_password")
Response.Cookies("UserCookie").Expires="2010/1/1"
end if
session.Timeout=60
Response.Write("<script>window.top.location.reload();</script>")
rsadmin.close
set rsadmin=nothing
end if
end if%>

<META content="MSHTML 6.00.2900.3268" name=GENERATOR>
<script language="javascript">
function checkform(){
if(form1.u_user.value=="" || form1.u_user.value=="请输入用户名"){
//alert("请输入用户名");
ShowAlert('错误!','请输入用户名',200,100);
form1.u_user.focus();
return false
}else if(form1.u_password.value==""){
//alert("请输入密码");
ShowAlert('错误!','请输入密码',200,100);
form1.u_password.focus();
return false
}else if(form1.passcode.value==""){
//alert("请输入验证码");
ShowAlert('错误!','请输入验证码',200,100);
form1.passcode.focus();
return false
}else{
form1.submit();
}
return true
}


</script>
<style type="text/css">
<!--
body,td,th {
font-family: 宋体;
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #666666;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #666666;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
}
-->
</style></HEAD>
<BODY oncontextmenu="return false;">
<%if request.Cookies("UserCookie")("User")<>"" then

set rs=server.createobject("adodb.recordset")

sql="select * from hxt_user where u_user='"&request.Cookies("UserCookie")("User")&"'"

rs.open sql,conn,1,3

session("users")=true
session("user")=request.Cookies("UserCookie")("User")
session("name")=rs("u_name")
session("time")=rs("u_times")
session("hit")=rs("u_hit")
rs.close
end if
%>
<%if session("users")=true then%>

<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><%=session("name")%> 您好!</td>
</tr>
<tr>
<td>上次登录时间:<%=session("time")%></td>
</tr>
<tr>
<td>总共登录次数:<%= session("hit") %></td>
</tr>

<tr>
<td><input type="submit" name="button3" id="button3" value="注销" onClick="window.location='userlogout.asp'"></td>
</tr>
</table>

<%else%>
<form name="form1" method="post" action="?action=login">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>用户名:
<input name="u_user" type="text" id="u_user" style="width:120px"></td>
</tr>
<tr>
<td>密  码:
<input name="u_password" type="password" id="u_password" style="width:120px"></td>
</tr>
<tr>
<td>验证码:
<input name="passcode" id="passcode" size="6" maxlength="4">
<img src="inc/code.asp" border="0" align="absmiddle" style="cursor:hand;" onClick="javascript:this.src='inc/code.asp';"></td>
</tr>
<tr>
<td align="center"><label>
<input name="cook" type="checkbox" id="cook" value="1" />
记住我的登录状态</label></td>
</tr>
<tr>
<td align="center"><input type="submit" name="button" id="button" value="登 录" />
 
<input type="reset" name="button2" id="button2" value="重 填" /></td>
</tr>
<tr>
<td align="center"><a href="reg.asp" target="_blank">新用户注册</a> <a href="#">忘记密码</a></td>
</tr>
</table>
</form>
<%end if%>

</BODY>
</HTML>


这是 inc/function.asp

<!--#include file="conn.asp" -->
<!--#include file="inc.asp" -->
<!--#include file="md5.asp" -->
这是code.asp
<%
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("verifycode") = 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("comm/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("comm/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
%>
各位高手,我这写了一个登入的界面,但是在打开时,显示不了验证内容...帮帮忙 呀,谢谢呀...
最后还有更奇怪的是,在DW下编辑,说在onclick标签的IMG属性不支持,我的验证码没显示,是这个原因不...怎么解决呀...谢谢了
...全文
158 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzp4881 2009-11-11
  • 打赏
  • 举报
回复
Option Explicit 把这句注释掉看看
另外看看其它include file里面有没有
On Error Resume Next
这句,如果有也注释掉
zgl13995510263 2009-11-10
  • 打赏
  • 举报
回复
有这两个文件...
lzp4881 2009-11-10
  • 打赏
  • 举报
回复
看看comm文件夹下面有没有这两个文件
body.Fix
head.fix

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧