daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Sep 21st, 2016 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LOGIN
  2.  
  3.  
  4. <?php
  5. /*
  6. * Template name: login-function
  7. */
  8. session_start();
  9. session_destroy();
  10. session_start();
  11.  
  12. $username = 'induction';
  13. $password ='password';
  14.  
  15. $username1 = 'vendor';
  16. $password1 = 'vendorpass';
  17.  
  18. $username2 = 'contractor';
  19. $password2 = 'contractorpass';
  20.  
  21. $data = $_POST;
  22.  
  23. //Check username and password
  24. if(($data['username'] == $username && $data['password'] == $password)
  25.                 || ($data['username'] == $username1 && $data['password'] == $password1
  26.                 || ($data['username'] == $username2 && $data['password'] == $password2)) {
  27.                 echo 'success';
  28.                 $_SESSION['logged_in'] = true;
  29.  
  30.                 if ( $data['username'] == $username1 ) {
  31.                                 $_SESSION['logged_in_contractor'] = true;        
  32.                 }
  33.  
  34.                 elseif ( $data['username'] == $username2 ) {
  35.                                 $_SESSION['logged_in_vendor'] = true;              
  36.                 }
  37.  
  38.                 header("Location: policies");
  39. }
  40. else {
  41.                 echo 'failure';
  42.                 header("Location: login?login_error=invalid");
  43. }
  44.  
  45.  
  46. ?>
  47.  
  48. HEADER
  49.  
  50.  
  51.                 <?php
  52.                 if ( $_SESSION['logged_in_hts'] )
  53.                 {
  54.                   wp_nav_menu( array( 'theme_location' => 'new-menu', 'container_class' => 'new_menu_class', 'menu_class' => 'nav navbar-nav navbar-left', 'depth'=> 3, 'container'=> false, 'walker'=> new hays_menu ) );
  55.                 }
  56.                 elseif ( $_SESSION['logged_in_vendor'] )
  57.                 {
  58.                   wp_nav_menu( array( 'theme_location' => 'contractor-menu', 'container_class' => 'new_menu_class', 'menu_class' => 'nav navbar-nav navbar-left', 'depth'=> 3, 'container'=> false, 'walker'=> new hays_menu ) );
  59.                 }
  60.                 // elseif ( $_SESSION['logged_in_contractor'] )
  61.                 // {
  62.                 //   wp_nav_menu( array( 'theme_location' => 'vendor-menu', 'container_class' => 'new_menu_class', 'menu_class' => 'nav navbar-nav navbar-left', 'depth'=> 3, 'container'=> false, 'walker'=> new hays_menu ) );
  63.                 // }
  64.                 else {
  65.                   wp_nav_menu( array('menu' => 'Main', 'menu_class' => 'nav navbar-nav navbar-left', 'depth'=> 3, 'container'=> false, 'walker'=> new hays_menu));
  66.                 }
  67.                 ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand