Hi,
I'm currently setting up an authentication system.
My current layout is to get his email from the $_POST
, md5 his password, and check the database against his email and his password.
If it matches, I use session_start
, and I start storing data in the $_SESSION
variable, like so:
$_SESSION['uid'] = $uid;
$_SESSION['first_name'] = $first_name;
And on every page of the website, I would preform a simple check of
isset($_SESSION['uid']);
if not, redirect to index page, if is, load the page.
Am I doing this correctly? Is this secure enough? How easy is it for someone to forge that data?
Someone told me that I should create a table, with the user's email, and his session-id and use that to manage things... I've become rather confused - how would this help?
Could someone clarify this? What is the correct way to manage authentication with PHP sessions?
Thanks.