Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. //Details in asterisk to hide.
  2. '<?php
  3. define('DB_SERVER', '******');
  4. define('DB_USERNAME', '*******');
  5. define('DB_PASSWORD', '*******');
  6. define('DB_DATABASE', '*******');
  7. $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. $query = "SELECT user_id, username, user_password FROM User_Login WHERE username='$username' AND user_password='$password'",
  15. $username = mysqli_real_escape_string($db,$_GET['username']),
  16. $password = mysqli_real_escape_string($db,$_GET['password']);
  17.  
  18. // Perform Query
  19. $result = mysqli_query($db,$query);
  20.  
  21. // Check result
  22. // This shows the actual query sent to MySQL, and the error. Useful for debugging.
  23. if (!$result) {
  24. $message = 'Invalid query: ' . mysqli_error($db) . "n";
  25. $message .= 'Whole query: ' . $query;
  26. die($message);
  27. }
  28.  
  29. // Use result
  30. // Attempting to print $result won't allow access to information in the resource
  31. // One of the mysql result functions must be used
  32.  
  33. while ($row = mysqli_fetch_assoc($result)) {
  34. echo $row['$username'];
  35. echo $row['username'];
  36. echo $row['user_password'];
  37. }
  38.  
  39. // Free the resources associated with the result set
  40. // This is done automatically at the end of the script
  41. mysqli_free_result($result);
  42. ?>`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement