.
My question is more of a general functionality one; I plan to have the login work as such...
.
The registration form gets the data;
- Collect IP address of user at registration, store in database as varchar(15) [such as [000.000.000.000']
- Collect desired userame
- Collect desired password and confirmation of password
- Collect email address and confirmation of email address
.
The registration PHP processes the data;
- Scan the user table and ensure username is available
- Scan the user table and ensure email is available
- Compare password & conf, email & conf - ensure they match before continuing.
- Check password for strength (minimum one Ucase, one Lcase, and one Numeral character, 8 to 16 characters in length)
- Collect datetime stamp of user registration
- Prepend encrypted (SHA1) IP to password, append encrypted (SHA1) datetime to password, encrypt this string (MD5)
- Store username, email, encrypted password, registration IP, and registration datetime in database table
- Send confirmation email with activation link
.
The table stores the following fields;
- userID {int(10), Auto_Increment, Primary Key}
- userName {varchar(32), unique}
- email {varchar(32), unique}
- password {varchar(32) [binary]}
- activated {tinyint(1), default '0'}
- registeredDate {datetime}
- registeredIP {varchar(15), default '000.000.000.000'}
- lastLoggedDate {datetime}
- lastLoggedIP {varchar(15), default '000.000.000.000'}
- curentDate {datetime}
- currentIP {varchar(15), default '000.000.000.000'}
.
The login form collects the data;
- username
- password
- Remember Me
- current IP address
.
The login PHP processes the data;
- Check for username in table
- call from table the registrationIP and registrationDate
- salt and encrypt the password
- compare passwords and log in or error out
- Store currentIP and currentDate,
- set cookie to keep logged in
The activation link sets 'activated' to true or 1.
The login script populates the 'currentDate' and 'currentIP' upon logging in.
The logout script populates and updates 'lastLoggedDate' and 'lastLoggedIP' from the 'current' fields upon logging out (either due to inactivity or by clicking the log out link), as well as clearing the 'current' fields.
.
Okay, so far I believe I have come up with a fairly strong registration and login script which provides for some extra functionality (such as "you last logged in on DATE, from IP") and can track the current IP to make sure the user who logged in is the only one using that session.
.
I thought of keeping a table of login attempts, which stores every login attempt, tracking: logged in/failed (0/1), IP, DateTime, and username... but I am not sure if that is needed or would be a waste of time / server space? I think this is necessary to block IPs and/or usernames that fail to log in X times, but I am not certain I need that functionality...?
.
Up to this point, is there anything I am missing, or just doing wrong?
.
.
Next, the big question; a checkbox field on the login page allows for 'Remember Me' or 'Keep me logged in.'... is it okay to store the encrypted password and a username on the clients computer? If not, what is the best (most secure without losing user convenience) way to approach this functionality?
This post has been edited by karossii: 23 November 2008 - 12:17 AM

New Topic/Question
Reply




MultiQuote





|