<% Response.Buffer = True 'Buffers the content so our Response.Redirect will work Session("BlnAdministrator")=false 'set the username and password sUsername="FFXwarrior" sPassword="Kill" %> <font color=Blue>Cookie Login Script
Make your own free website on Tripod.com
<% 'if form has not been filled in then display it otherwise check the details submitted If Request.Form<>"" Then If Request.form("checkbox") ="1" Then Response.Cookies("UsernameCookie") = Request.Form("txtUsername") Response.Cookies("PasswordCookie") = Request.Form("txtPassword") Response.Cookies("RememberMeCookie") = "1" Response.Cookies("UsernameCookie").expires = Now() + 60 Response.Cookies("PasswordCookie").expires = Now() + 60 Response.Cookies("RememberMeCookie").expires = Now() + 60 Else Response.Cookies("RememberMeCookie") = "" Response.Cookies("UsernameCookie") = "" Response.Cookies("PasswordCookie") = "" End If '=== call checklogin subroutine CheckLoginForm Else '=== call showlogin subroutine ShowLoginForm End If '=== begin subroutine showlogin Sub ShowLoginForm %>

" method="post">
 
Username : " name="txtUsername" type="text">
Password : " name="txtPassword" type="password">
 
Remember me >
<% '=== end showloginform subroutine End Sub '===begin subroutine checkloginform Sub CheckLoginForm txtUsername=Request.Form("txtUsername") txtPassword=Request.Form("txtPassword") 'simple/basic protection against SQL injection use of the apostrophe If InStr(1,txtUsername,"'",1) > 0 and InStr(1,txtPassword,"'",1) > 0 then response.redirect "Login.asp" Else 'check to see if the form details filled in match 'username' and 'password' above If txtUsername = sUsername AND txtPassword = sPassword Then 'if the correct login details are filled in then set up a Session Object and redirect 'visitor to admin page Session("BlnAdministrator") = True Response.Redirect "admin.asp" 'set page you want to direct to on successful login Else 'if the correct details aren't filled in then show the subroutine showloginform again 'and the statement below ShowLoginForm response.write "
Your login failed.
" End If End If End Sub '=== end subroutine checkloginform %>