Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php
  2. /*
  3.   SIGN-IN.php
  4.   VERSION 1.0
  5. */
  6. $page = "login";
  7. include('assets/layout/header.php');
  8. //check if already logged in move to home page
  9. if( $user->is_logged_in() ){ header('Location: ./dashboard'); }
  10. //process login form if submitted
  11. $returned = $_POST['return'];
  12. if(isset($_POST['submit'])){
  13.     $username = $_POST['username'];
  14.     $password = $_POST['password'];
  15.     if($user->login($username, $password, $remember)){
  16.         $_SESSION['username'] = $username;
  17.         if(!empty($returned)) {
  18.             header("Location: /".$_POST["return"]);
  19.             exit;
  20.         } else {
  21.             header("Location: /dashboard.php");
  22.             exit;
  23.         }
  24.     } else {
  25.         $error[] = 'Wrong username or password or your account has not been activated.';
  26.     }
  27. }//end if submit
  28. if(isset($error)){
  29.     foreach($error as $error){
  30.         $msg = '<div class="alert alert-danger" role="alert">'.$error.'</div>';
  31.     }
  32. }
  33. if(isset($_GET['action'])) {
  34.     switch ($_GET['action']) {
  35.         case 'joined':
  36.             $msg = "<div class='alert alert-warning'>Registration successful. Manual activation of your account is required before you can login.</div>";
  37.             break;
  38.     }
  39. }
  40. ?>
  41.     <div id="sub-header">
  42.         <div class="container">
  43.             <div class="row">
  44.                 <div class="col-md-8 col-md-offset-2">
  45.                     <h1>Signing in to WPM DEV</h1>
  46.                 </div>
  47.             </div>
  48.         </div>
  49.     </div>
  50.     <div class="container">
  51.         <div class="row">
  52.         </div>
  53.     </div>
  54.     <div id="sign-in">
  55.         <div class="container">
  56.             <div class="row">
  57.                 <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
  58.                     <?php echo $msg; ?>
  59.                     <form role="form" method="POST" action="<? echo $_SERVER['PHP_SELF'];?>" autocomplete="off">
  60.                         <input type="hidden" name="return" id="return" class="form-control input-sm" value="<?php echo $_GET['return']; ?>" tabindex="1"><br>
  61.  
  62.                         <div class="form-group">
  63.                             <input type="text" name="username" id="username" class="form-control input-lg" placeholder="Enter your username" value="<?php if(isset($error)){ echo $_POST['username']; } ?>" tabindex="1">
  64.                         </div>
  65.                         <div class="form-group">
  66.                             <input type="password" name="password" id="password" class="form-control input-lg" placeholder="Enter your password" tabindex="2">
  67.                         </div>
  68.                         <div class="row">
  69.                             <div class="col-xs-6 col-md-6">
  70.                                 <input type="submit" name="submit" value="Sign-in" class="btn btn-primary btn-block btn-lg" tabindex="3">
  71.                             </div>
  72.                             <div class="col-xs-6 col-md-6">
  73.                                 <a href="./sign-up" class="btn btn-info btn-block btn-lg" tabindex="3">Sign up</a>
  74.                             </div>
  75.                             <div class="col-xs-12">
  76.                                 <br>
  77.                                 <p class="text-center">Forgot your password? Reset it <a href="/forgot-password">here</a>.</p>
  78.                             </div>
  79.                         </div>
  80.                     </form>
  81.                 </div>
  82.             </div>
  83.         </div>
  84.     </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement