Posts Tagged Login Php
Login form with PHP
Posted by in PHP code on July 23rd, 2009
- First you need to create table for your user with fields: username and password.
- Create basic HTML form that user will fill username and password. This should be easy.
- The action form should should then check whether username and password is valid or not from database. You can encrypt the password using md5 functions. When you check the password supplied by user you need to md5 it too with the value stored in database.
- If user successfully login, then register session and redirect them to other page, like the admin page. The code to register session and redirect them is:
session_register(“username”);
session_register(“password”);
header(“location:admin.php”);
session_register(“password”);
header(“location:admin.php”);
- When user logout you must delete the session:
session_start();
session_destroy();
session_destroy();









