i built several sites with very simple code of php and so far so good, but i happens that I'm now worried about topic "security" i wonder what is the best way to create a login/authentication process in PHP
this is what I currently do:
during registration the user submit an email and a password the password will be stored, in mysql, as an md5 string, so anybody but the user knows it.
when the user login, i do
SELECT * FROM usertable WHERE email = $emailsubmitted AND pass = md5($passsubmitted)
then if the sizeof the resulting array is more then zero, it means the user exists
so I set
session_start();
$_SESSION['logged'] = 'true';
$_SESSION[userid] = userid;
so for everypage the user browse i'll perform a check to see if the session variable exists.
BOTTOM LINE: I wonder if this is safe enough and how it can be improved.