Advertisement
Ramaraunt1

Untitled

May 5th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2. // Ramaraunt's Scriptset for PW 4.5.
  3. // Copyright 2017 with MIT Licsence (see LISCENCE.txt for details)
  4.  
  5. /*
  6. Purpose:
  7. To give a player online status, and to tell the game server if a new player is
  8. necessary.
  9. */
  10.  
  11. //get passes and stuff
  12. include 'config.php';
  13.  
  14. //check if password is valid
  15. if($valid == 1)
  16. {
  17.  
  18. $unique_id = $_GET['guid'];
  19.  
  20. $connection = mysqli_connect($db_address, $db_user, $db_pass, $database_name);
  21.  
  22. $query = mysqli_query($connection,"SELECT guid FROM account WHERE guid = '$unique_id';") or die(mysqli_error($connection));
  23. mysqli_store_result($connection);
  24. $number_of_players_with_guid = msqli_numbers_rows($query);
  25. if ($number_of_players_with_guid == 0)
  26. {
  27. //create a new player in the database. Need to tell the game server the player doesnt exist.
  28. echo "1|$unique_id|";
  29. }
  30. else
  31. {
  32. //Let's set the player's status to online.
  33. mysqli_query($connection,"UPDATE account SET status='1' WHERE guid='$unique_id';");
  34. }
  35.  
  36. //close the connection
  37. mysqli_close($connection);
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement