Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="form1" name="form1" method="post" action="index.php">
- <p>Nome: <input name="email" type="text"> </p>
- <p>Senha: <input type="text" name="senha"> </p>
- <input type="submit" name="post_back" id="button" value="Submit">
- </form>
- <?php
- session_start();
- require("config.php");
- if(isset($_REQUEST["post_back"])){
- $tb = $conn->prepare("select id_usuario from usuario where email_usuario=:email and senha_usuario=:senha");
- $salt = $_POST["senha"];
- $custo = '08';
- $hash = crypt($senha, '$2a$' . $custo . '$' . $salt . '$');
- $tb->bindParam(":email", $_POST["email"], PDO::PARAM_STR);
- $tb->bindParam(":senha", $hash, PDO::PARAM_STR);
- $tb->execute();
- $l = $tb->fetch(PDO::FETCH_ASSOC);
- $tb = null;
- if(!empty($l)){
- $_SESSION["usuario"] = $l["id_usuario"]; header("Location: dados.php");
- }else{
- echo "<script>alert('Login Falhou');</script>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement