creating a login cookie
(Sorry if this topic was covered somewhere earlier)
A friend of mine has a site that has lots of "members only pages". What's annoying is that everytime you visit you need to login again with your email address and password. I told him that he should use a cookie (and a checkbox) to 'remember' the user to automatically login in again everytime an authorized visitor returns. He said he doesn't know anyting about cookies and since I'm the one who suggested it, now I'm trying to figure out how to do this on his behalf.
Things to know:
1) I have no idea what langueage he wrote his site in but if that's essential I can find out.
2) It's nothing so important where a simple "remember me" cookie poses any real security issue. It's just a simple alumni message board.
zollet posted this at 07:45 — 13th August 2002.
He has: 1,016 posts
Joined: May 2002
I suggest you find out what language the members area is written in. I mean, if it's in ASP, it wouldn't help if you provided you with PHP code..
fifeclub posted this at 18:11 — 13th August 2002.
He has: 688 posts
Joined: Feb 2001
His answer was "The site is all in ASP which mixes VBScript, JavaScript, and HTML."
Suzanne posted this at 22:03 — 13th August 2002.
She has: 5,507 posts
Joined: Feb 2000
And so, I'm moving this to the Scripting Forum...
ASP Login is the question.
Mark Hensler posted this at 05:08 — 14th August 2002.
He has: 4,048 posts
Joined: Aug 2000
<%
' creating/updating a cookie
Response.Cookies("Username") = Username
Response.Cookies("Username").Expires = DateAdd("d", 1, Date)
Response.Cookies("Password") = Password
Response.Cookies("Password").Expires = DateAdd("d", 1, Date)
' reading a cookie
Username = Request.Cookies("Username")
Password = Request.Cookies("Password")
' clearing a cookie
Response.Cookies("Username") = ""
Response.Cookies("Password") = ""
%>
You'll probably want to create a header file you can include everywhere. That way, no matter where they enter the site, it will read the cookie and log them in.
Mark Hensler
If there is no answer on Google, then there is no question.
fifeclub posted this at 03:49 — 15th August 2002.
He has: 688 posts
Joined: Feb 2001
Thanks. I passed this along. If he has more questions I'm going to suggest that he come here to ask directly. Thanks again.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.