Advertisement
Guest User

Untitled

a guest
Nov 8th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2. $host = "locahost";
  3. $user = "crcom758_mark";
  4. $pass = "ascacibas";
  5. $banco = "crcom758_marketing";
  6. $conexao = mysql_connect($host, $user, $pass) or die(mysql_error());
  7. mysql_select_db($banco) or die (mysql_error());
  8. ?>
  9.  
  10. <html>
  11.  
  12. <head>
  13. <title></title>
  14. <script type="text/javascript">
  15. function loginsuccessfully() {
  16. setTimeout("window.location='painel.php'", 5000);
  17. }
  18.  
  19. function loginfailed(){
  20. setTimeout ("window.location='index.php'", 5000);
  21.  
  22. }
  23. </head>
  24.  
  25. <body>
  26. <?php
  27. $email = $_POST['Email'];
  28. $senha = $_POST['Senha'];
  29. $slc = mysql_query ("SELECT * FROM usuarios WHERE email = '$email' and senha = '$senha' ") or die (mysql_error());
  30. $row = mysql_num_rows($sql);
  31. if($row > 0) {
  32. session_start();
  33. $_SESSION['email']=$_POST['email'];
  34. $_SESSION['senha']=$_POST['senha'];
  35. echo "Você foi autenticado com sucesso!";
  36. echo "<script>loginsuccessfully()</script>";
  37. }else {
  38. echo "Nome de usuário ou senha inválidos!";
  39. echo "<script>loginfailed()</script>";
  40. }
  41. ?>
  42.  
  43. </body>
  44.  
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement