Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
129
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->execute();
  17.  
  18.     if ( !$result ) {
  19.         throw new Error($stmt->errorInfo());
  20.     }
  21.     else {
  22.         header("location: admin2.php");
  23.     }
  24. }
  25.    
  26. ?>
  27.  
  28. <!DOCTYPE html>
  29. <html>
  30. <head>
  31. <title>SQL Injection</title>
  32. </head>
  33. <body>
  34. <form action="index2.php" method="POST">
  35. <h1>SQL Injection - Teste</h2><br>
  36. Usuário:<br>
  37. <input type="text"
  38. name="usuario"><br>
  39. Senha:<br>
  40. <input type="text"
  41. name="senha"><br>
  42. <input type="submit" value="Login">
  43. </Form>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement