http://mr-w.cn/
一直被這個問題所困擾!!現在終於完美解決啦!!獻給那些需要前台記住登錄信息的朋友!(此方法經過我的使用驗證不存在星鈴丹管理員所說的後台會持續登陸的安全隱患...後台還是和原版一樣的,效果只針對前台!!)
感謝Wady和IFairy...
請大家不要只看不回,只回不來我的博客坐坐...回帖是美德!做人要厚道!!
下面是修改方法...
1.首先修改common/checkUser.asp(主要是這個!!)
將以下原碼
[Copy to clipboard]CODE:
'進行MD5密碼驗證,轉換舊帳戶密碼驗證方式
dim strSalt
strSalt=randomStr(6)
memLogin("mem_salt")=strSalt
memLogin("mem_LastIP")=getIP()
memLogin("mem_lastVisit")=now()
memLogin("mem_hashKey")=HashKey
memLogin("mem_Password")=SHA1(Password&strSalt)
Response.Cookies(CookieName)("memName")=memLogin("mem_Name")
Response.Cookies(CookieName)("memHashKey")=HashKey
if Request.Form("KeepLogin")="1" then Response.Cookies(CookieName).Expires=Date+365
memLogin.Update
ReInfo(0)="登錄成功"
ReInfo(1)="<b>"&memLogin("mem_Name")&"</b>,歡迎你的再次光臨。<br/><a href=""default.asp"">點擊返回主頁</a>"
ReInfo(2)="MessageIcon"
ReInfo(3)=true
End IF
else
if memLogin("mem_Password")<>SHA1(Password&memLogin("mem_salt")) then
ReInfo(0)="錯誤信息"
ReInfo(1)="<b>用戶名與密碼錯誤</b><br/><a href=""javascript:history.go(-1);"">請返回重新輸入</a>"
ReInfo(2)="ErrorIcon"
logout(false)
else
memLogin("mem_LastIP")=getIP()
memLogin("mem_lastVisit")=now()
memLogin("mem_hashKey")=HashKey
Response.Cookies(CookieName)("memName")=memLogin("mem_Name")
Response.Cookies(CookieName)("memHashKey")=HashKey
if Request.Form("KeepLogin")="1" then Response.Cookies(CookieName).Expires=Date+365
memLogin.Update
ReInfo(0)="登錄成功"
ReInfo(1)="<b>"&memLogin("mem_Name")&"</b>,歡迎你的再次光臨。<br/><a href=""default.asp"">點擊返回主頁</a><meta http-equiv=""refresh"" content=""3;url=default.asp""/>"
ReInfo(2)="MessageIcon"
ReInfo(3)=true
end if
end if
memLogin.Close
Set memLogin=Nothing
login=ReInfo
end function
修改成
[Copy to clipboard]CODE:
'進行MD5密碼驗證,轉換舊帳戶密碼驗證方式
dim strSalt
strSalt=randomStr(6)
memLogin("mem_salt")=strSalt
memLogin("mem_LastIP")=getIP()
memLogin("mem_lastVisit")=now()
memLogin("mem_hashKey")=HashKey
memLogin("mem_Password")=SHA1(Password&strSalt)
Response.Cookies(CookieName)("memName")=memLogin("mem_Name")
Response.Cookies(CookieName)("memHashKey")=HashKey
if Cint(Request.Form("KeepLogin"))<>0 then Response.Cookies(CookieName).Expires=Date+Cint(Request.Form("KeepLogin"))
memLogin.Update
ReInfo(0)="登陸成功"
ReInfo(1)="<b>"&memLogin("mem_Name")&"</b>,歡迎你的再次光臨。<br/><a href=""default.asp"">點擊返回主頁</a>"
ReInfo(2)="MessageIcon"
ReInfo(3)=true
End IF
else
if memLogin("mem_Password")<>SHA1(Password&memLogin("mem_salt")) then
ReInfo(0)="錯誤信息"
ReInfo(1)="<b>用戶名與密碼錯誤</b><br/><a href=""javascript:history.go(-1);"">請返回重新輸入</a>"
ReInfo(2)="ErrorIcon"
logout(false)
else
memLogin("mem_LastIP")=getIP()
memLogin("mem_lastVisit")=now()
memLogin("mem_hashKey")=HashKey
Response.Cookies(CookieName)("memName")=memLogin("mem_Name")
Response.Cookies(CookieName)("memHashKey")=HashKey
if Cint(Request.Form("KeepLogin"))<>0 then Response.Cookies(CookieName).Expires=Date+Cint(Request.Form("KeepLogin"))
memLogin.Update
ReInfo(0)="登陸成功"
ReInfo(1)="<b>"&memLogin("mem_Name")&"</b>,歡迎你的再次光臨。<br/><a href=""default.asp"">點擊返回主頁</a><meta http-equiv=""refresh"" content=""3;url=default.asp""/>"
ReInfo(2)="MessageIcon"
ReInfo(3)=true
end if
end if
memLogin.Close
Set memLogin=Nothing
login=ReInfo
end function
然後搜索
[Copy to clipboard]CODE:
memLogin("mem_LastIP")=getIP()
有三處!將其刪除...
再搜索
[Copy to clipboard]CODE:
if CheckCookie("mem_LastIP")<>Guest_IP or isNull(CheckCookie("mem_LastIP")) then
logout(true)
else
memName=CheckStr(Request.Cookies(CookieName)("memName"))
memStatus=CheckCookie("mem_Status")
end if
替換為
[Copy to clipboard]CODE:
memName=CheckStr(Request.Cookies(CookieName)("memName"))
memStatus=CheckCookie("mem_Status")
2.修改login.asp:
將以下代碼替換<form name="checkUser" action="login.asp" method="post">至</form>斷
[Copy to clipboard]CODE:
<form name="checkUser" action="login.asp" method="post">
<div id="MsgContent">
<div id="MsgHead">用戶登錄</div>
<div id="MsgBody">
<input name="action" type="hidden" value="login"/>
<label>用戶名:<input name="username" type="text" size="18" class="userpass" maxlength="24"/></label><br/>
<label>密 碼:<input name="password" type="password" size="18" class="userpass"/></label><br/>
<%if blog_useCode then%><label>驗證碼:<input name="validate" type="text" size="4" class="userpass" maxlength="4"/> <%=getcode()%></label><br/><%end if%>
<label>記住登陸: <select name="KeepLogin" id="KeepLogin" class="userpass">
<option value="1" selected="selected">一天</option>
<option value="30" >一個月</option>
<option value="365">一年</option>
<option value="0">不用記住</option>
</select>
</label>
<br/>
<input type="submit" value="登 錄" class="userbutton"/> <input type="button" value="用戶注冊" class="userbutton" onclick="location='register.asp'"/>
</div>
</div>
</form>
附首頁顯示登陸框的方法
在library.asp裡查找 退出系統</a>" 將以下代碼替換原來的
[Copy to clipboard]CODE:
else
userPanel=userPanel&"<form name=""checkUser"" action=""login.asp"" method=""post"" style=""margin:1px;""><input name=""action"" type=""hidden"" value=""login""/><label>用戶:<input name=""username"" type=""text"" size=""12"" class=""userpass"" maxlength=""24""/></label><br/><label>密碼:<input name=""password"" type=""password"" size=""12"" class=""userpass""/></label><br/><label>驗證:<input name=""validate"" type=""text"" size=""4"" class=""userpass"" maxlength=""4""/> "&getcode()&"</label><br/><label>記住登陸: <select name=""KeepLogin"" id=""KeepLogin"" class=""userpass""><option value=""1"" selected=""selected"">一天</option><option value=""30"" >一個月</option><option value=""365"">一年</option><option value=""0"">不用記住</option></select></label><br/><input type=""submit"" value=""登錄"" class=""userbutton""/><input type=""button"" value=""會員注冊"" class=""userbutton"" onclick=""location.href='register.asp'""/></form>"
end if
end function
如果你懶得改或不會改的話請下載我打的包,覆蓋原文件即可!(修改有風險,請自行備份原文件!!)
點擊下載此文件