Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "localhost";
  4. $user = "root";
  5. $pass = "";
  6. $banco = "Cadastro";
  7.  
  8. $conexao = mysql_connect($host, $user, $pass) or die(mysql_error());
  9. mysql_select_db($banco) or die(mysql_error());
  10. ?>
  11.  
  12. <html>
  13. <head>
  14. <title>
  15.  
  16. </title>
  17. <script type="text/javascript">
  18.  
  19. function Loginsuccessfully(){
  20.  
  21. setTimeout ("window.location='painel.php'", 5000);
  22.  
  23. }
  24.  
  25. function Loginfailed() {
  26.  
  27. setTimeout("window.location='Login.php'", 5000);
  28. }
  29.  
  30. </script>
  31.  
  32. </head>
  33. <body>
  34.  
  35. <?php
  36.  
  37. $email=$_POST['email'];
  38. $senha=$_POST['senha'];
  39.  
  40. $sql= mysql_query("SELECT * FROM usuarios WHERE email = '$email' and senha = '$senha'") or die (mysql_error());
  41. $row = mysql_num_rows($sql);
  42. if ($row > 0) {
  43.  
  44.  
  45.  
  46. session_start();
  47. $_SESSION['email']=$_POST['email'];
  48. $_SESSION['senha']=$_POST['senha'];
  49.  
  50. echo "Voรงe foi autenticado com sucesso! aguarde um instante.";
  51. echo "<script>Loginsuccessfully()</script>";
  52. } else {
  53.  
  54. echo "<center>Nome de usuario Invalido! aguarde um instante para voltar a tentar</center>";
  55.  
  56. echo "<script>Loginfailed()</script>";
  57. }
  58.  
  59.  
  60. ?>
  61. </html>
  62. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement