Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include_once '../back/login.php';
- if (!isset($_SESSION['log']))
- {
- ?>
- <html lang="pt-BR">
- <head>
- <title>TodoIF</title>
- <meta charset="utf-8">
- <!-- <link rel="stylesheet" type="text/css" href="front.css">-->
- </head>
- <body>
- <div class="tabs">
- <label for="tab1" id="tab_label" class="tab_label">LOGIN</label>
- <div class="tab_content"></div>
- <h2>BEM VINDO!</h2>
- <form method="post" action="../back/login.php">
- <label for="email">E-mail:</label>
- <input type="text" id="email" name="email"/><br><br>
- <label for="key">Senha:</label>
- <input type="text" type="password" name="senha"/><br><br>
- <button type="submit" name="logar">Login</button>
- <div class="links">
- <a href="" style="font-size: 14px;">Não tenho cadastro</a><br>
- <a href="">Esqueci minha senha</a>
- </div>
- </form>
- </div>
- </body>
- </html>
- <?php
- }else
- {
- $_SESSION['msg'] = "Você já está logado";
- header("location: dashbord.php");
- }
- ?>
- <?php
- include_once 'connect.php';
- include_once 'bcrypt.php';
- include_once 'register.php';
- //include_once 'loginfront.php';
- if(isset($_POST['logar']))
- {
- var_dump($_POST);
- $dbh= Conexao();
- $email= $_POST['email'];
- $password_user= $_POST['senha'];
- try {
- $sql= ("SELECT `id`, `email`, `password_user` FROM `users` WHERE email = '$email'");
- $result= $dbh->prepare($sql);
- $result->execute(array('email'=> $email,'senha'=> $password_user));
- $result= $result->fetch();
- var_dump($result);
- if (Bcrypt::check($password_user, $hash) == $hash) {
- session_start();
- $_SESSION["id"] = $result["id"];
- header("Location: ../front/dashbord.php");
- }else {
- echo "<script>alert('Login ou senha inválidos. Tente novamente')</script>";
- }
- }catch(PDOexception $error) {
- echo 'Erro ao fazer login.'.$error->getMessage();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment