Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <meta charset="utf-8">
  2. <?php
  3.  
  4. session_start();
  5.  
  6. if(!$conect=mysqli_connect('localhost','root','','cadastros'))
  7. die ('erro ao conectar');
  8.  
  9.  
  10. if (!empty($_POST) AND (empty($_POST['email']) OR empty($_POST['senha']))) {
  11. header("Location: index.html"); exit;
  12. }
  13.  
  14.  
  15. $email = $_POST['email'];
  16. $senha = $_POST['senha'];
  17.  
  18. $sql = "SELECT * FROM usuarios WHERE email ='$email' AND senha = md5('$senha')";
  19.  
  20. $resultado = @mysqli_query($conect, $sql);
  21.  
  22. $linhas = mysqli_num_rows($resultado);
  23.  
  24. if($linhas==0) {
  25. function myAlert($msg, $url){
  26. echo '<script language="javascript">alert("'.$msg.'");</script>';
  27. echo "<script>document.location = '$url'</script>";
  28. }
  29. myAlert("Email ou Senha incorretos! Verifique os dados inseridos!", "/teste_cad/Login/index.html");
  30. }
  31. else{
  32. $_SESSION["autenticado"]="rfc822_allowed";
  33. $_SESSION["login"]=$email;
  34. header("Location: profile.php");}
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement