Advertisement
Guest User

Untitled

a guest
Aug 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. mysqli_query("SELECT email, passwd, login_id, full_name FROM members WHERE email = 'x'; DROP TABLE members; --'");
  2.  
  3. <?php
  4. // Prevent errors from showing
  5. error_reporting(0);
  6. // Connect the db
  7. require '../../connect_db.php';
  8.  
  9. if (isset($_POST['UserName'], $_POST['UserPass'] ) ) {
  10.  
  11. // Grab user Input
  12. $UserName = $_POST['UserName'];
  13. $UserPass = $_POST['UserPass'];
  14.  
  15. // The passwords in this case are stored in the clear. This is an early example.
  16. // BINARY is used to force matching case.
  17. $query = "SELECT * FROM users WHERE UserName='".$UserName."' AND BINARY UserPass='".$UserPass."'";
  18.  
  19. $result = mysqli_query($db, $query)
  20. or die("Error: " . mysqli_error($db));
  21.  
  22.  
  23. // Echo out the table row(s)
  24. while($row = mysqli_fetch_array($result)) {
  25. echo '<tr class="query-result">'; // Class is added so that jQuery can remove old ones
  26. echo '<td>' . $row['UserId'] . '</td>';
  27. echo '<td>' . $row['UserName'] . '</td>';
  28. echo '<td>' . $row['UserPass'] . '</td>';
  29. echo '<td>' . $row['UserRole'] . '</td>';
  30. echo '</tr>';
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement