<%@language=vbscript codepage=936 %>
<%
option explicit
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'主要是使随机出现的图片数字随机
%>
<html>
<head>
<title>TEst</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc/southidc.css">
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
<SCRIPT language=JavaScript>
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</SCRIPT>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onselectstart="return false">
<table width="1003" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="998"><img src="images/01_r1_c1.jpg" width="998" height="135"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r2_c1.jpg" width="998" height="86"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r3_c1.jpg" width="998" height="107"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r4_c1.jpg" width="998" height="87"></td>
</tr>
<tr>
<td width="988" height="243" background="images/01_r5_c1.jpg"><table width="856" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="159" valign="top"><table width="29%" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="Admin_ChkLogin.asp" name=form1 method=post onSubmit="return checkform(form1)" autocomplete="off">
<tr>
<td width="58" height="32"><font color="#FFFFFF">用户名:</font></td>
<td width="190" height="32"><input name="username" value="" type="text" class="input1"></td>
</tr>
<tr>
<td height="32"><font color="#FFFFFF">密 码:</font></td>
<td height="32"><input type="password" name="password" value="" class="input1"></td>
</tr>
<tr>
<td height="32"><font color="#FFFFFF">验证码:</font></td>
<td height="32"><input type="text" name="CheckCode" value="" class="input1"> <img src="inc/checkcode.asp"></td>
</tr>
<tr>
<td height="32"> </td>
<td height="32"><input name="image" type="image" src="Image/bt_login.gif" width="70" height="16"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td height="36"><div align="center" class="STYLE1">安阳市阳光传媒资讯工作室正版授权 版本编号:SUNSHINE8.NO.0807</div></td>
</tr>
</table></td>
</tr>
</table> <script language=Javascript>
form1.username.focus()
function checkform(form)
{
var flag=true;
if(form("username").value==""){alert("请输入用户名!");form("username").focus();return false};
if(form("password").value==""){alert("请输入密码!");form("password").focus();return false};
if(form("CheckCode").value==""){alert("请输入验证码!");form("CheckCode").focus();return false};
return flag;
}
</script></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
<%@language=vbscript codepage=936 %>
<%
option explicit
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'主要是使随机出现的图片数字随机
%>
<html>
<head>
<title>TEst</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc/southidc.css">
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
<SCRIPT language=JavaScript>
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</SCRIPT>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onselectstart="return false">
<table width="1003" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="998"><img src="images/01_r1_c1.jpg" width="998" height="135"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r2_c1.jpg" width="998" height="86"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r3_c1.jpg" width="998" height="107"></td>
</tr>
<tr>
<td width="998"><img src="images/01_r4_c1.jpg" width="998" height="87"></td>
</tr>
<tr>
<td width="988" height="243" background="images/01_r5_c1.jpg"><table width="856" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="159" valign="top"><table width="29%" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="Admin_ChkLogin.asp" name=form1 method=post onSubmit="return checkform(form1)" autocomplete="off">
<tr>
<td width="58" height="32"><font color="#FFFFFF">用户名:</font></td>
<td width="190" height="32"><input name="username" value="" type="text" class="input1"></td>
</tr>
<tr>
<td height="32"><font color="#FFFFFF">密 码:</font></td>
<td height="32"><input type="password" name="password" value="" class="input1"></td>
</tr>
<tr>
<td height="32"> </td>
<td height="32"><input name="image" type="image" src="Image/bt_login.gif" width="70" height="16"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td height="36"><div align="center" class="STYLE1">安阳市阳光传媒资讯工作室正版授权 版本编号:SUNSHINE8.NO.0807</div></td>
</tr>
</table></td>
</tr>
</table> <script language=Javascript>
form1.username.focus()
function checkform(form)
{
var flag=true;
if(form("username").value==""){alert("请输入用户名!");form("username").focus();return false};
if(form("password").value==""){alert("请输入密码!");form("password").focus();return false};
}
</script></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
问题补充 2009-12-08 09:56
<%@language=VBScript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file="../Inc/Config.asp"-->
<!--#include file="inc/md5.asp"-->
<%
dim sql,rs
dim username,password,CheckCode
username=replace(trim(request("username")),"'","")
password=replace(trim(Request("password")),"'","")
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 FoundErr<>True then
password=md5(password)
set rs=server.createobject("adodb.recordset")
sql="select * from Admin where 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='Login.asp'><< 返回登录页面</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
%>
两个地方,改一下就行了:
1、验证码验证成功或失败以后,立即给其Session赋值为空:Session("CheckCode")=""
2、调取验证码图片时,加一个随机数,你那个清除缓存是清除的服务器端缓存,跟客户端没半点关系,具体做法:<img src="CheckCode.asp?rd=<%=ASP随机数%>" />,如果还要点击变换验证码则加: onclick="this.src=CheckCode.asp?' + Math.random()"
把
if CheckCode="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>验证码不能为空!</li>"
end if
if session("CheckCode")="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>你登录时间过长,请重新返回登录页面进行登录。</li>"
end if
和
if CheckCode<>CStr(session("CheckCode")) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>您输入的确认码和系统产生的不一致,请重新输入。</li>"
end if
这两段注释掉,登录的时候就不会执行验证码检查了