Forum Moderators: coopster

Message Too Old, No Replies

Creating User Login

         

icpooreman

3:30 am on Dec 30, 2005 (gmt 0)

10+ Year Member



I'm looking into writing a login script. It doesn't have to be foolproof as my site doesn't have that sensitive of information on it. I kind of want it to work similar to this site you log in once and then you can venture the site as you please.

That being said I'm not really sure how it should be structured.

I kind of like this site how you log in once and then you're good for the current visit and subsequent visits until your cookie expires. I'm not sure what goes into that though can you request cookies with php.

My other idea is you can just login when they get to the site and just continue to check vs there IP until they leave the site then log them out (not the most secure solution but should work).

basically I've never done this before and am just looking for general suggestions from anyone who has as to how I should structure it/any general advice they might have for me.

mack

1:59 pm on Jan 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If I where you I would base it on cookies, IP addresses are a little to insecure, and if a user is on a dynamic IP they would have to log in each time they revisited.

The first thing you need to work out of how usernames and passwords will be stored on the server side. For this the 2 main options are a text file or a database. You will also need a script to handle registration and subsiquent logins.

What I would tend to do is create a mysql database with a tablecalled members. I would then use a cell for username, password and any other details you want to store such as profile information.

In sign up the first thing you need to do is check to see is a users choice of username is already in use. If so tell then the username is already taken and ask then to choose another name. This can be done using mysql select. If the name is available then write the new user details to the mysql database.

For a user log in you should use a simple html form to point the user to a login script. What you need to do is send the username and password to the script. The script will then select from password where username=whatever if the password the user provides is the same as the password selected from mysql then access is allowed.

Mack.