% @language="vbscript" %>
<% Dim LPage:LPage=True %>
<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("uid"),Request("pwd")) Then
' If comparison was good, store the user name...
Session("uid") = Request("uid")
if Request.Form("cbrem")="on" then 'Remember me flag is ON: storing UID and PWD in cookies
Response.Cookies("jsfpl")("1") = Request("uid")
Response.Cookies("jsfpl")("2") = Request("pwd")
Response.Cookies("jsfpl").Expires = Now+30 ' Cookie keep time in days: here is 30 days from present
else 'Erase Cookie if flag is not set
Response.Cookies("jsfpl")("1") = ""
Response.Cookies("jsfpl")("2") = ""
Response.Cookies("jsfpl").Expires = Now-1
end if
on error resume next
' ...and redirect back to the original page.
Dim Con, sql, rec
set Con = Server.CreateObject("ADODB.Connection")
openstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("fpdb/logon.mdb")
Con.Open openstr
'Select the record matching the username.
sql = "SELECT * FROM tblUsers WHERE UID = '" & Session("UID") & "'"
set rec=Con.execute(sql)
Nam = rec.Fields("NAME")
Homer = rec.Fields("HOME")
Response.Redirect(homer) 'Change to page redirect to after login
if err then
response.write "
Link is: " & Homer
response.write "
Name is: " & Nam
response.write "
Error is: " & Err.Description
response.write "
Uid is: " & Session("UID")
response.write "
Ref is: " & Session("REFERRER")
End if
End If
End If
'If this page is not posted then run code below:
Dim User,Pass,chb
User="" & Request.Cookies("jsfpl")("1")
Pass="" & Request.Cookies("jsfpl")("2")
if Not( User="" and Pass="") then
chb="checked"
end if
%>