PDA

View Full Version : Login script using cookies required


IceManJoe
12-29-2002, 01:26 PM
Hi,

I wonder if someone could make my life abit easier!

I would like a login script to a dsnless connection access database using cookies so that 'remember password' can be used.

I have looked on the web and found simple login scripts, i require a script to show errors such as 'incorrect username' and 'incorrect password'. I would also like it to show your username when u have logged in and an option to logout.

Has anyone any decent scripts they have found and would like to make an old man happy?

Thanks

Joe

whammy
12-29-2002, 02:20 PM
Hi,

I have a basic login/registration script on my website - however, I've been meaning for months to write a better one, so I'm writing it now.

This will be a login/registration script that is self-contained (posts to itself) so the logic should be much clearer. It will use a cookie to see if people are logged in.

My original took me hours to write, but I want to see how fast (and how well!) I can do this now that I'm experienced. ;)

whammy
12-29-2002, 04:19 PM
Here you go - this one is a bit better than my original - you may have to change the database path according to your host, and you'll have to change the confirmation email accordingly as well (tip: use a REAL email address registered with your host for best results):

whammy
12-29-2002, 04:28 PM
P.S. In order to show the username, etc. when someone is logged in, you'll just need to add a bit of code to "login.asp", like so (right after the other Response.Cookies code):

Response.Cookies("login")("username") = username

Then to display it on any page once logged in, you can use:

<% = Request.Cookies("login")("username") %>

Of course, you also include the check on each page:

<!-- #include file="checklogin.asp" -->

Like all scripts, this will still require a bit of work for you to customize, but it has all the important parts done for ya. ;)

P.S. Make sure you read all of the comments in "register.asp", they explain what things are doing pretty well, I think...