Browse > Home /

| Subcribe via RSS

Simple login system with php

Today I will be creating my first post for WarezTeacher and to help you create a simple login system for your admin… 

Firslty we need to create a file that will hold your password and security check!

Step 1 (Create Auth File).

Create a new file and name it anything you want but for this example we’ll use auth.php.

  1. <?php
  2. session_start();//this will be used to hold your admin session
  3. $MyPassword = "Admin"; //this will be your login password
  4. $Form = '<form action="" method="post" name="loginForm">
  5. <input name="password" type="password" />
  6. <input type="submit" value="Submit" />';
  7.  
  8. if(!$_SESSION['AdminAuth']){//check if allready logged in
  9. if(!$_POST['password']){
  10. die($Form);
  11. }else{
  12. if($_POST['password'] != $MyPassword ){
  13. die('PASSWORD FAIL!');
  14. }else{
  15. $_SESSION['AdminAuth'] = TRUE;
  16. }
  17. }
  18. }
  19. ?>

Now what ever pages you want to secure you should just include the file with the include command at the very top of your sucure page.

Hope you like this tutorial and please stay tuned at WarezTeacher for more!!!

Tags: , ,