Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <?php
  2. header_remove();
  3. function set_content_length($output)
  4. {
  5. header("Content-Length: ".strlen($output));
  6. return $output;
  7. }
  8. ob_start("set_content_length");
  9. //the above part is for fixing a warband reading headers error
  10. if(isset($_GET['event']) && isset($_GET['uniqueid']) && isset($_GET['localid'])&& isset($_GET['username']))
  11. {
  12. $uniqueid=$_GET["uniqueid"];
  13. $localid=$_GET["localid"];//for feedback only
  14. $username=$_GET["username"];
  15. $head = $_GET['head'];
  16. $body = $_GET['body'];
  17. $legs = $_GET['legs'];
  18. $gloves = $_GET['gloves'];
  19. $slot1 = $_GET['slot1'];
  20. $slot2 = $_GET['slot2'];
  21. $slot3 = $_GET['slot3'];
  22. $slot4 = $_GET['slot4'];
  23.  
  24.  
  25. $db_handle = mysqli_connect("127.0.0.1", "crayz", "1HgaUxbJ0XRWfY3w", "crayz") or die("|-1");
  26. if($db_handle)
  27. if($_GET['event'] == 1)//get player gold & stuff
  28. {
  29. $sql_result = mysqli_query($db_handle, "SELECT Gold FROM players WHERE UniqueId = '$uniqueid'" );
  30. $result = mysqli_fetch_row($sql_result);
  31.  
  32. if (!$result)
  33. $sql_result = mysqli_query($db_handle, $s);
  34. if($sql_result === FALSE)
  35. die(mysqli_error($db_handle)." |-3|");
  36.  
  37. {//the player is not in the database, so we will insert it
  38. mysqli_query($db_handle, "INSERT INTO players (UniqueId,Username,Gold,Head,Body,Legs,Gloves,slot1,slot2,slot3,slot4) VALUES($uniqueid, '$username', 0, 564, 418, 795, -1, -1, -1, -1, -1)");
  39. echo "1|$uniqueid|$localid|0|564|418|795|-1|-1|-1|-1|-1|";//and we will echo gold as 0
  40. }else{
  41. echo "1|$uniqueid|$localid|$gold|$head|$body|$legs|$gloves|$slot1|$slot2|$slot3|$slot4|".$result[0];
  42. }
  43. }else if($_GET['event'] == 2)//set player gold
  44. {
  45. if(isset($_GET['gold']))//if the gold is set
  46. {
  47. $gold = $_GET['gold'];
  48. mysqli_query($db_handle, "INSERT INTO `players` (`Username`, `UniqueId`, `Head`, `Body`, `Legs`, `Gloves`, `Slot1`, `Slot2`, `Slot3`, `Slot4`, `Gold`)".
  49. " VALUES('$username', $uniqueid, $head, $body, $legs, $gloves, $slot1, $slot2, $slot3, $slot4, $gold) ON DUPLICATE KEY UPDATE ".
  50. "Username=VALUES(Username),".
  51. "Head=VALUES(Head),".
  52. "Body=VALUES(Body),".
  53. "Legs=VALUES(Legs),".
  54. "Gloves=VALUES(Gloves),".
  55. "Slot1=VALUES(Slot1),".
  56. "Slot2=VALUES(Slot2),".
  57. "Slot3=VALUES(Slot3),".
  58. "Slot4=VALUES(Slot4),".
  59. "Gold=VALUES(Gold)");
  60.  
  61. }
  62. }
  63. mysqli_close($db_handle);
  64. }
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement