Advertisement
Guest User

Untitled

a guest
Nov 8th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. <?
  2.  
  3. include('config.php');
  4. include('functions.php');
  5. include('rcon.php');
  6.  
  7. $host = '51.254.126.147'; // Server host name or IP
  8. $port = 25571; // Port rcon is listening on
  9. $password = 'VfhbyfRehl4rjdf123'; // rcon.password setting set in server.properties
  10. $timeout = 3; // How long to timeout.
  11.  
  12. $rcon = new Rcon($host, $port, $password, $timeout);
  13.  
  14.  
  15. if ($_REQUEST)
  16. {
  17. $errs = array();
  18. $sum = trim($_REQUEST["summ"]);
  19. $pay_id = trim($_REQUEST["pay_id"]);
  20.  
  21. $shop_id = '1627';
  22. $secret_key = '843721195';
  23. $signature = md5($shop_id.':'.$_REQUEST['summ'].':'.$_REQUEST['pay_id'].':'.$secret_key);
  24.  
  25.  
  26. function getIP() {
  27. if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
  28. return $_SERVER['REMOTE_ADDR'];
  29. }
  30. if (!in_array(getIP(), array('185.162.128.88'))) {
  31. die("hacking attempt!");
  32. }
  33.  
  34. if ($signature != $_REQUEST['sign']) {
  35.  
  36. die('ERROR_bad sign');
  37.  
  38. }
  39.  
  40. $id = mysqli_fetch_array(mysqli_query($mysql,"SELECT * FROM `payments` WHERE id = '$pay_id'"))or die('Ошибка получения id платежа');
  41.  
  42. if($id['sum'] != $_REQUEST['summ']){
  43. die('Сумма изменена');
  44. }
  45.  
  46. switch ($id['type']) {
  47. case 'group':
  48. $user=$id['account'];
  49. $group= $id['group'];
  50. $rcon->connect();
  51. $rcon->send_command("sync console all pex user $user group set $group");
  52. break;
  53. case 'unban':
  54.  
  55.  
  56. $user=$id['account'];
  57. $rcon->connect();
  58. $rcon->send_command("sync console all unban $user");
  59.  
  60. break;
  61. case 'money':
  62.  
  63.  
  64. $user= $id['account'];
  65. $money = $id['group'];
  66. $rcon->connect();
  67. $rcon->send_command("eco give $user $money");
  68. break;
  69.  
  70. case 'case':
  71.  
  72. $user= $id['account'];
  73. $key= $id['group'];
  74. $rcon->connect();
  75. $rcon->send_command("crate give v $key 1 $user");
  76. break;
  77. }
  78.  
  79.  
  80. die('OK');
  81.  
  82.  
  83.  
  84.  
  85. }
  86.  
  87.  
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement