Perfect solution to PJ's Cookies save time limit problem! Optional record of landing time!_ application skills

Source: Internet
Author: User
Tags md5 sha1
http://mr-w.cn/
Have been plagued by this problem!! Now finally the perfect solution!! To those who need the front desk to remember the login information! (This method after my use of verification does not exist the star Bell Dan Admin said the background will continue to log security risks ...) Backstage is the same as the original, the effect is only for the foreground!!
Thanks to Wady and Ifairy ...
Please don't just look back, just don't come back to my blog to sit ... Replies are virtues!


Here is how to modify ...

1. First modify common/checkuser.asp (mainly this!!)
The following original code


[Copy to Clipboard] CODE:
' Make MD5 password verification, convert old account password authentication method
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) = "Login Succeeded"
Reinfo (1) = "<b>" &memlogin ("Mem_name") & "</b&gt", welcome to your visit again. <br/><a href= "Default.asp" "> Click Back Home </a>"
Reinfo (2) = "Messageicon"
Reinfo (3) =true
End IF
Else
If Memlogin ("Mem_password") <>sha1 (Password&memlogin ("Mem_salt")) Then
Reinfo (0) = "error Message"
Reinfo (1) = "<b> username and password error </b><br/><a href=" "Javascript:history.go (-1);" " > Please return to re-enter </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) = "Login Succeeded"
Reinfo (1) = "<b>" &memlogin ("Mem_name") & "</b&gt", welcome to your visit again. <br/><a href= "Default.asp" > Click Back Home </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

Modified into


[Copy to Clipboard] CODE:
' Make MD5 password verification, convert old account password authentication method
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) = "Landing Success"
Reinfo (1) = "<b>" &memlogin ("Mem_name") & "</b&gt", welcome to your visit again. <br/><a href= "Default.asp" "> Click Back Home </a>"
Reinfo (2) = "Messageicon"
Reinfo (3) =true
End IF
Else
If Memlogin ("Mem_password") <>sha1 (Password&memlogin ("Mem_salt")) Then
Reinfo (0) = "error Message"
Reinfo (1) = "<b> username and password error </b><br/><a href=" "Javascript:history.go (-1);" " > Please return to re-enter </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) = "Landing Success"
Reinfo (1) = "<b>" &memlogin ("Mem_name") & "</b&gt", welcome to your visit again. <br/><a href= "Default.asp" > Click Back Home </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

and then search


[Copy to Clipboard] CODE:
Memlogin ("Mem_lastip") =getip ()

There are three places! Delete it ...

Search again


[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

Replaced by


[Copy to Clipboard] CODE:
Memname=checkstr (Request.Cookies (CookieName) ("MemName"))
Memstatus=checkcookie ("Mem_status")

2. Modify Login.asp:
Replace the following code with <form name= "CheckUser" action= "Login.asp" method= "post" > To </form> broken


[Copy to Clipboard] CODE:
<form name= "CheckUser" action= "Login.asp" method= "POST" >
<div id= "Msgcontent" >
<div id= "Msghead" > User login </div>
<div id= "Msgbody" >
<input name= "Action" type= "hidden" value= "Login"/>
<label> User name: <input name= "username" type= "text" size= "" class= "Userpass" maxlength= "a"/></label> <br/>
<label> Password: <input name= "password" type= "password" size= "class=" and "Userpass"/></label><br/>
<%if Blog_usecode then%><label> Authentication code: <input name= "Validate" type= "text" size= "4" class= "Userpass" Maxlength= "4"/> <%=getcode ()%></label><br/><%end if%>
<label> Remember login: <select name= "Keeplogin" id= "Keeplogin" class= "Userpass" >
<option value= "1" selected= "selected" > Day </option>
<option value= > one month </option>
<option value= "365" > One year </option>
<option value= "0" > Don't remember </option>
</select>
</label>
<br/>
<input type= "Submit" value= "Login" class= "Userbutton"/> <input type= "button" value= "User Registration" class= "Userbutton" onclick= "location= ' register.asp '"/>
</div>
</div>
</form>

The method of displaying the landing box on the first page
Find exit system in library.asp </a> "replace the following code with the original


[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> User: <input  name= "username" " type=" "Text" " size=" "," " class=" "Userpass" " maxlength=" "/>" " </label><br/><label> Password: <input name= "" Password ""  type= "" Password ""  size= "" ""  class= "" Userpass ""/></label><br/><label> Authentication: <input name= "" Validate ""  type= "" Text ""  size= "" 4 ""  class= "" Userpass ""  maxlength= "" 4 ""/>  "&getcode () & "</label><br/><label> Remember to login:  <select name=" "Keeplogin" " id=" "Keeplogin" " class=" "Userpass" "><option value=" "1" " selected=" "Selected" "> One day </option>< Option value= ""  > one month </option><option value= "" 365 "> One year </option><option value= "" 0 "" > Don't remember </option></select></label><br/><input type= "" Submit ""  value= "" Login ""  class= "" Userbutton ""/><input type= "" button ""  value= "" Member registration "  class= "Userbutton" " onclick=" "location.href= ' Register.asp '" "/></form>"
End If
End Function

If you do not bother to change or do not change, please download my bag, cover the original file can! (Changes are risky, please back up the original file!!)

Click to download this file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.