Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Login handlers
- case 'login';
- $username = $_POST['username'];
- $password = sha1($_POST['password'] . $_POST['username']);
- $data = $pdo->select("*", "usuario where nombre = '$username'");
- $_SESSION['login']['username'] = $_POST['username'];
- switch($data['rows']){
- case 0:
- $_SESSION['error'] = "Usuario Invalido";
- header('Location: index.php');
- break;
- case 1:
- if($password == $data['select'][0]['pass']){
- $_SESSION['login'] = array(
- 'valid' => 'ofc',
- 'username' => $data['select'][0]['nombre'],
- 'tipo' => $data['select'][0]['tipo'],
- 'idboda' => $data['select'][0]['idboda_FK']
- );
- if($_SESSION['login']['tipo'] == 'admin'){
- header('Location: administrador/index.php');
- }else if($_SESSION['login']['tipo'] == 'superadmin'){
- header('Location: superadministrador/index.php');
- }
- }else{
- $_SESSION['error'] = "Password Invalido";
- header('Location: index.php');
- }
- break;
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement