Advertisement
Guest User

Untitled

a guest
Mar 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <?php
  2. $ini = parse_ini_file('config.ini');
  3. $link = mysqli_connect($ini['db_host'],$ini['db_user'],$ini['db_password']);
  4. $database = mysqli_select_db($link,$ini['db_name']);
  5. $user = $_GET['username'];
  6. $password = $_GET['password'];
  7. $hwid = $_GET['hwid'];
  8. $tables = $ini['mybb_usertable'];
  9. $sql = "SELECT * FROM ". $tables ." WHERE username = '". mysqli_real_escape_string($link,$user) ."'" ;
  10. $result = $link->query($sql);
  11. if ($result->num_rows > 0) {
  12. // Outputting the rows
  13. while($row = $result->fetch_assoc())
  14. {
  15.  
  16. $password = $row['password'];
  17. $salt = $row['salt'];
  18. $plain_pass = $_GET['password'];
  19. $stored_pass = md5(md5($salt).md5($plain_pass));
  20.  
  21. function Redirect($url, $permanent = false)
  22. {
  23. if (headers_sent() === false)
  24. {
  25. header('Location: ' . $url, true, ($permanent === true) ? 301 : 302);
  26. }
  27. exit();
  28. }
  29.  
  30. if($stored_pass != $row['password'])
  31. {
  32. echo "p0<br>"; // Wrong pass, user exists
  33. }
  34. else
  35. {
  36. echo "p1<br>"; // Correct pass
  37. }
  38.  
  39. echo "g" . $row['usergroup'] . "<br>";
  40.  
  41. if (strlen($row['hwid']) > 1)
  42. {
  43. if ($hwid != $row['hwid'])
  44. {
  45. echo "0"; // Wrong
  46. }
  47. else
  48. {
  49. echo "1"; // Correct
  50. }
  51. }
  52. else
  53. {
  54. $sql = "UPDATE ". $tables ." SET hwid='$hwid' WHERE username='$user'";
  55. if(mysqli_query($link, $sql))
  56. {
  57. echo $row['hwid'];
  58. echo "3"; // HWID Set
  59. }
  60. else
  61. {
  62. echo "4"; // Else errors
  63. }
  64. }
  65. }
  66. }
  67. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement