Advertisement
jzmwebdevelopment

index.php

Mar 22nd, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.49 KB | None | 0 0
  1. <?php
  2.  
  3. ob_start();
  4.  
  5. session_start();
  6. include('../includes/header.php');
  7.  
  8. include('includes/class/class.login.php'); // Login
  9.  
  10. include('includes/class/class.form.php');
  11.  
  12. $Action = "index.php";
  13.  
  14. $formLogin = new Form($Action, 'login','post','return CheckLogin();','');
  15.  
  16.     //when form is submitted
  17.     if(isset($_POST["submit"])){
  18.    
  19.         //Set sticky data for the form from POST array
  20.         $aFormData = $_POST;
  21.         $formLogin->setStickyData($aFormData);
  22.        
  23.         //validate form data
  24.     //  $formLogin->checkNotEmpty("Username");
  25.     //  $formLogin->checkNotEmpty("Password");
  26.        
  27.         //Authenticate when form is valid
  28.         if($formLogin->getValid() == true){
  29.            
  30.             //Intitialising
  31.             $sLoginMessage = "";
  32.            
  33.             $userLogin = new Login();
  34.            
  35.             $bLoadSuccess = $userLogin->userLogin($_POST["Username"]);
  36.            
  37.             if($bLoadSuccess == true){
  38.                 //successful load
  39.                
  40.                 if ($userLogin->getPassword() == md5($_POST["Password"])){
  41.                     //password is correct
  42.                    
  43.                     $_SESSION["id"] = $userLogin->getUserID();
  44.                    
  45.                     header("Location: adminarea.php");
  46.                     exit;
  47.                
  48.                 }else{
  49.                     //password is incorrect
  50.                     $sLoginMessage = "Password is not correct";
  51.                 }
  52.             }else{
  53.                 //unsuccessful load
  54.                 $sLoginMessage = "Login name does not exist";
  55.             }
  56.         }
  57.     }
  58. $formLogin->openFieldset();
  59. $formLogin->makeInputBox("Username","Username","CheckInput(this.id);");
  60. $formLogin->makePasswordBox("Password","Password");
  61. $formLogin->makeSubmitButton("submit","Login");
  62. $formLogin->closeFieldset();
  63.  
  64.  
  65. ?>
  66.    <section class="left">
  67.    
  68.         <h1  class="Heading">Login To Admin Area</h1>
  69.        
  70.         <p class="loginError"><?php echo $sLoginMessage ?></p>
  71.    
  72.        <?php echo $formLogin->getHTML(); ?>
  73.        
  74.     </section> <!-- Section Left End -->
  75.    
  76.     <section class="right">
  77.         <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
  78.         Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
  79.         It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  80.         </p>
  81.     </section><!-- Section Right End -->
  82.  
  83.        
  84.     <?php include('../includes/footer.php'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement