Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1.     //Login handlers
  2.     case 'login';
  3.         $username = $_POST['username'];
  4.         $password = sha1($_POST['password'] . $_POST['username']);
  5.         $data = $pdo->select("*", "usuario where nombre = '$username'");
  6.         $_SESSION['login']['username'] = $_POST['username'];
  7.         switch($data['rows']){
  8.             case 0:
  9.                 $_SESSION['error'] = "Usuario Invalido";
  10.                 header('Location: index.php');
  11.             break;
  12.            
  13.             case 1:
  14.                 if($password == $data['select'][0]['pass']){
  15.                     $_SESSION['login'] = array(
  16.                         'valid' => 'ofc',
  17.                         'username' => $data['select'][0]['nombre'],
  18.                         'tipo' => $data['select'][0]['tipo'],
  19.                         'idboda' => $data['select'][0]['idboda_FK']
  20.                     );
  21.                     if($_SESSION['login']['tipo'] == 'admin'){
  22.                         header('Location: administrador/index.php');
  23.                     }else if($_SESSION['login']['tipo'] == 'superadmin'){
  24.                         header('Location: superadministrador/index.php');
  25.                     }
  26.                 }else{
  27.                     $_SESSION['error'] = "Password Invalido";
  28.                     header('Location: index.php');
  29.                 }
  30.             break;
  31.         }
  32.     break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement