Pages

Thursday, 3 May 2012

PHP LOGIN System

Features:

  • Registration
  • Lost password
  • Various checks on passwords and usernames
  • users can change their password
  • Passwords are stored in a database with a seed added to it and they have sha1 encryption
  • Easy to adjust & use

Requirements:

  • Mysql database
  • a php & mysql enabled host
  • php mail() enabled host
  • ftp access to your website
OR
  • XAMPP
Below is an Overview that How many Programs we are going to create for Our Login System and How to setup a database 


  1. Creating the Database and table in  mysql 
  2. Creating a db_connect.inc.php file
  3. Creating the header.php file
  4. Creating the footer.php file
  5. Creating the index.php file
  6. Creating the login.php file
  7. Creating the logout.php file
  8. Creating a function.inc.php file
  9. Creating the mail.functions.inc.php file
  10. Creating the display.functions.inc.php file
  11. Creating the login.functions.inc.php file
  12. Creating the user.functions.inc.php file
  13. Creating the validation.functions.inc.php file
  14. Creating the lostpassword.php file
  15. Creating the changepassword.php file
  16. Creating the register.php file
  17. Creating the activate.php file
Lets start with the First step
  1. Creating the Database and table in  mysql 
steps for Creating Database and table in MySQL
  1.  Open Xampp control panel and start Apache and MYSQL Server and a Display Running Should be seen as Shown in the below figure.



    2.      open your browser and Type your hostname/phpmyadmin 
             Example: in mine case Localhost/phpmyadmin

  3. Then you will see the Page as shown in the Figure below. Now click on "Databases" and Type  a Database name example: "loginsystem" and click create


4.  Now we shall create a Table in our Database. To do that Follow the steps below



 5. Now copy the Below Sql Query and paste in The Sql window as shown Below figure
    

  CREATE TABLE  `login` (`loginid` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(30) NOT NULL,
  `password` varchar(50) NOT NULL,
  `email` varchar(255) NOT NULL,
  `actcode` varchar(45) NOT NULL,
  `disabled` tinyint(1) NOT NULL default '0',
  `activated` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`loginid`)
);

---->first Click on SQL tab then Copy the Code above and then Press Go Button which is located aligned at the Right Side




Then you should Get as Message as Shown below.

6. Now we have to insert a sample Value in our Table, to do that Click on SQL tab inside "Loginsystem" Database


7. insert into login (username,password,email,activated) value ('admin',sha1(concat('admin','0dAfghRqSTgx')),'mymail@mail.com','1');
Copy the Above Sql Query and Paste in the SQL query Window as show in the Figure Below and Press Go and Remember after you press Go it shout Give the Message that "Your Sql query has been Executed Successfully"





Our First Step is Complete now i.e., Creation of Database and Table in Mysql
  Lets move on the Nest Step. Creating a db_connect.inc.php  file >> 

No comments:

Post a Comment

Thank you for your valuable comment