Advertisement
Guest User

Untitled

a guest
Mar 7th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. GNU nano 2.2.6 File: sql_get.php
  2.  
  3. <?php
  4. $servername = "127.0.0.1";
  5. $username = "root";
  6. $password = "notplaningtodisclosure that";
  7. $dbname = "either way fuck you";
  8.  
  9. // Create connection
  10. $conn = new mysqli($servername, $username, $password, $dbname);
  11. // Check connection
  12. if ($conn->connect_error) {
  13. die("Connection failed: " . $conn->connect_error);
  14. }
  15. $vorname = $_GET['vorname'];
  16. $sql = "SELECT userid, username, nachname FROM kunden WHERE vorname ='".$vorname."';";
  17. $result = $conn->query($sql); // sql injection there
  18.  
  19. if ($result->num_rows > 0) {
  20. // output data of each row
  21. while($row = $result->fetch_assoc()) {
  22. echo "id: " . $row["userid"]. " - Username: " . $row["username"]. " " . $row["nachname"]. "<br>";
  23. }
  24. } else {
  25. echo "0 results";
  26. }
  27. $conn->close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement