Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header_remove();
- function set_content_length($output)
- {
- header("Content-Length: ".strlen($output));
- return $output;
- }
- ob_start("set_content_length");
- //the above part is for fixing a warband reading headers error
- if(isset($_GET['event']) && isset($_GET['uniqueid']) && isset($_GET['localid'])&& isset($_GET['username']))
- {
- $uniqueid=$_GET["uniqueid"];
- $localid=$_GET["localid"];//for feedback only
- $username=$_GET["username"];
- $head = $_GET['head'];
- $body = $_GET['body'];
- $legs = $_GET['legs'];
- $gloves = $_GET['gloves'];
- $slot1 = $_GET['slot1'];
- $slot2 = $_GET['slot2'];
- $slot3 = $_GET['slot3'];
- $slot4 = $_GET['slot4'];
- $db_handle = mysqli_connect("127.0.0.1", "crayz", "1HgaUxbJ0XRWfY3w", "crayz") or die("|-1");
- if($db_handle)
- if($_GET['event'] == 1)//get player gold & stuff
- {
- $sql_result = mysqli_query($db_handle, "SELECT Gold FROM players WHERE UniqueId = '$uniqueid'" );
- $result = mysqli_fetch_row($sql_result);
- if (!$result)
- $sql_result = mysqli_query($db_handle, $s);
- if($sql_result === FALSE)
- die(mysqli_error($db_handle)." |-3|");
- {//the player is not in the database, so we will insert it
- 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)");
- echo "1|$uniqueid|$localid|0|564|418|795|-1|-1|-1|-1|-1|";//and we will echo gold as 0
- }else{
- echo "1|$uniqueid|$localid|$gold|$head|$body|$legs|$gloves|$slot1|$slot2|$slot3|$slot4|".$result[0];
- }
- }else if($_GET['event'] == 2)//set player gold
- {
- if(isset($_GET['gold']))//if the gold is set
- {
- $gold = $_GET['gold'];
- mysqli_query($db_handle, "INSERT INTO `players` (`Username`, `UniqueId`, `Head`, `Body`, `Legs`, `Gloves`, `Slot1`, `Slot2`, `Slot3`, `Slot4`, `Gold`)".
- " VALUES('$username', $uniqueid, $head, $body, $legs, $gloves, $slot1, $slot2, $slot3, $slot4, $gold) ON DUPLICATE KEY UPDATE ".
- "Username=VALUES(Username),".
- "Head=VALUES(Head),".
- "Body=VALUES(Body),".
- "Legs=VALUES(Legs),".
- "Gloves=VALUES(Gloves),".
- "Slot1=VALUES(Slot1),".
- "Slot2=VALUES(Slot2),".
- "Slot3=VALUES(Slot3),".
- "Slot4=VALUES(Slot4),".
- "Gold=VALUES(Gold)");
- }
- }
- mysqli_close($db_handle);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement