Guest User

Untitled

a guest
Oct 21st, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. <?php
  2. /**
  3. * Custom username field set in Plimus
  4. */
  5. $username_field = "In-Game_Name";
  6. /**
  7. * Email to send error messages too
  8. */
  9. $error_email = "deadlypkerzstaff@hotmail.com";
  10. /**
  11. * Contracts mappped to the item id they should give
  12. */
  13. $items = array("3025978" => "2460");
  14. /**
  15. * ipv4 address's of each plimus server
  16. */
  17. $plimus_ips = array("62.219.121.253", "209.128.93.248", "72.20.107.242",
  18. "209.128.93.229", "209.128.93.98", "209.128.93.230", "209.128.93.245",
  19. "209.128.93.104", "209.128.93.105", "209.128.93.107", "209.128.93.108",
  20. "209.128.93.242", "209.128.93.243", "209.128.93.254", "62.216.234.216",
  21. "62.216.234.218", "62.216.234.219", "62.216.234.220", "209.128.104.18",
  22. "209.128.104.19", "209.128.104.20", "209.128.104.21", "209.128.104.22",
  23. "209.128.104.23", "209.128.104.24", "209.128.104.25", "209.128.104.26",
  24. "209.128.104.27", "209.128.104.28", "209.128.104.29", "209.128.104.30",
  25. "209.128.104.31", "209.128.104.32", "209.128.104.33", "209.128.104.34",
  26. "209.128.104.35", "209.128.104.36", "209.128.104.37", "99.186.243.9",
  27. "99.186.243.10", "99.186.243.11", "99.186.243.12", "99.186.243.13",
  28. "99.180.227.233", "99.180.227.234", "99.180.227.235", "99.180.227.236",
  29. "99.180.227.237");
  30.  
  31. /**
  32. * Database settings, the variable names speak for themselfs
  33. */
  34. $db_host = "68.233.240.175";
  35. $db_user = "forum";
  36. $db_pass = "j;|L7+7)<{>O~_a";
  37. $db_name = "server;
  38. /**
  39. * The workings of the script
  40. */
  41. if(!@mysql_connect($db_host, $db_user, $db_pass)) {
  42. die(send_error("Error connecting to database server: " . mysql_error()));
  43. }
  44. if(!@mysql_select_db($db_name)) {
  45. die(send_error("Error selecting database: " . mysql_error()));
  46. }
  47. if (!array_search($_SERVER['REMOTE_ADDR'], $plimus_ips)) {
  48. die(send_error("Not a plimus server ip address " . $_SERVER['REMOTE_ADDR']));
  49. }
  50. if(isset($_POST['transactionType'])) {
  51. if($_POST['transactionType'] == "CHARGE") {
  52. $username = @mysql_real_escape_string($_POST[$username_field]);
  53. $item = getItemForContract(@mysql_real_escape_string($_POST['contractId']));
  54. if($item == 0) {
  55. die(send_error("no item mapped for " . $_POST['contractId'] . ""));
  56. }
  57. $quantity = @mysql_real_escape_string($_POST['quantity']);
  58. if(@mysql_query("INSERT INTO `plimus` (`username`, `item`, `quantity`) VALUES('" . $username . "', '" . $item . "', '" . $quantity . "');")) {
  59. die(send_error("Error inserting purchased item into the database " . mysql_error));
  60. }
  61. }
  62. }
  63.  
  64. function getItemForContract($contract) {
  65. global $items;
  66. foreach($items as $key=>$value) {
  67. if($key == $contract) {
  68. return $value;
  69. }
  70. }
  71. return 0;
  72. }
  73.  
  74. function send_error($error) {
  75. global $error_email;
  76. $headers = 'From: postmaster ' . "\r\n" . 'Reply-To: ' . $error_email . "\r\n" . 'X-Mailer: PHP/' . phpversion();
  77. mail($error_email, "Plimus IPN Error!", $error, $headers); //sec
  78. }
  79.  
  80. ?>
Add Comment
Please, Sign In to add comment