
April 4th, 2012, 10:59 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 2
Time spent in forums: 36 m 52 sec
Reputation Power: 0
|
|
|
Retrieving cookies
Hello, im new to programming. Im making a login program that will go check ms access and then direct them to specific pages. Now my problem is to display the contents of the int213userid cookie in the Employee ID text box the first time the page is loaded and If they fail to log in for any reason, keep the value of the Employee ID text box in the text box for their next attempt.
coding =
Code:
Dim empid, password, errormsg, checker, sameid
sameid = request.Cookies("int213userid")
checker = 0
Do While Not Objrs.EOF
If lcase(Request("empidfield")) = lcase(Objrs("empid")) AND Request("emppwfield") = Objrs("Password") Then
Session ("UserloggedIn") = "empidfield"
if Objrs("admin") = true then
if request("remember") = true then
'put cookie into int213userid
response.cookies("int213userid")=request("empidfield")
response.cookies("int213userid").Expires = date + 30
Response.Cookies("int213userid") = sameid
'Call Response.Redirect("menu.asp")
else
'Call Response.Redirect("menu.asp")
end if
End If
if Objrs("admin") = false then
if request("remember") = true then
response.cookies("int213userid")=request("empidfield")
response.cookies("int213userid").Expires = date +
30
Response.Cookies("int213userid") = sameid
'Call Response.Redirect("Payroll-entry.asp")
else
'Call Response.Redirect("Payroll-entry.asp")
end if
end if
else
Session ("UserloggedIn") = ""
errormsg= "error"
checker = 1
End If
Objrs.MoveNext loop
Objrs.close
set Objrs = nothing
Objconn.close
set Objconn = nothing
HTML =
Code:
<form method="post" name="login" action="" >
<p align="center">Employee ID:
<input name="empidfield" type="text" size="20" value="<%=sameid%>"/>
</p>
<p align="center">Password:
<input name="emppwfield" type="text" size="20" />
</p>
<p align="center"><input checked="checked" name="remember" value="checkit" type="checkbox" />Remember Employee ID<br /> </p>
<p align="center"> <input name="button" id="button" value="Login" type="submit" /> </p>
<p align="center"><font color="red">
i am trying different stuff but none of them are working. Please Help! Asking for help was my last resort before i pull my hair.  Thank You!
|