How to create secure PHP script login form page using session video tutorial
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:
Login:
This should be inside the login_go.php(the target page of the login form)
$user=$_GET['user'];
$password=$_GET['password'];
$result_login = mysql_query(“SELECT * from XXX WHERE user=’$user’ and password=’$password’”,$db);
if ($myrow_login = mysql_fetch_array($result_login))
$_SESSION['user']=$user;
Logout:
unset($_SESSION['user']);
session_destroy();
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.
Related Posts
- 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
- JavaScript tutorial validate form: Textboxes, select , check box – components and EMAIL validation








Comments (4)
hi this is rele a nice tutorial so would u mind to upload how to upload a profile picture by the members??
thanks
Hi!
Actually I have such a tutorial.
Here take a look:
http://www.webmastervideoschool.com/php_my_sql/video-tutorial-how-to-allow-users-upload-files-from-a-web-page-to-server-with-php/
Alex
Thanks, I thought it was more difficult
Hi,
Thank you for this script
I needed a little login script like this
Leave a reply