Advertisement
alantccgti

Untitled

Oct 15th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2. ini_set("display_errors",1);
  3.  
  4. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  5. $usuario = $_POST['usuario'];
  6. $senha = $_POST['senha'];
  7.  
  8. $root = 'root';
  9. $password= '1111';
  10. $conn = new PDO('mysql:host=localhost;dbname=fail', $root, $password);
  11.  
  12. $sql = "SELECT * FROM login WHERE usuario=:usuario AND senha=:senha;";
  13.           $stmt = $conn->prepare( $sql );
  14.       $stmt-> bindParam( ':usuario', $usuario );
  15.       $stmt-> bindParam( ':senha', $senha );     
  16.       $result = $stmt->fetchAll();
  17. var_dump($stmt);
  18.  
  19. if ( !$result ) {
  20.     throw new Error($stmt->errorInfo());   
  21.  
  22.    
  23. }
  24.  
  25. else {
  26.     header("location: admin2.php");
  27.    
  28.  
  29. }
  30. }  
  31. ?>
  32.  
  33. <!DOCTYPE html>
  34. <html>
  35. <head>
  36. <title>SQL Injection</title>
  37. </head>
  38. <body>
  39. <form action="index2.php" method="POST">
  40. <h1>SQL Injection - Teste</h2><br>
  41. Usuário:<br>
  42. <input type="text"
  43. name="usuario"<br><br>
  44. Senha:<br>
  45. <input type="text"
  46. name="senha"<br><br>
  47. <input type="submit" value="Login">
  48. </Form>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement