In this tutorial I will teach you to create secure login process using PHP session object variable and database to store the login information of our members.
This is very useful if you have a members are on your website.
This login process is very common and I am sure you will use it in your projects.
Here is the code I used:
This should be inside the login_go.php(the target page of the login form)
$result_login = mysql_query(“SELECT * from XXX WHERE user=’$user’ and password=’$password’”,$db);
if ($myrow_login = mysql_fetch_array($result_login))
Be sure to include session_start(); at the beginning of each page where sessions are used.
I strongly advice to ready my post about protecting your website form sql injection attacks before creating such a login form.
Fell free to contact me if any question.
- Video tutorial: How to create PHP Shopping cart using SESSION object variables
- Video tutorial: Form validation in Macromedia Dreamweaver
- How to create custom made 404 error file not found page on your website video tutorial
- Video tutorial: How to create CSS button rollover effect menu web design tutorial