Guest User

Untitled

a guest
Dec 22nd, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. include 'session.php';
  15. include 'functions.php';
  16. if (!$rPermissions['is_admin'] || (!hasPermissions('adv', 'add_user') && !hasPermissions('adv', 'edit_user'))) {
  17. exit();
  18. }
  19.  
  20. if (isset($_POST['submit_user'])) {
  21. $_POST['mac_address_mag'] = strtoupper($_POST['mac_address_mag']);
  22. $_POST['mac_address_e2'] = strtoupper($_POST['mac_address_e2']);
  23.  
  24. if (isset($_POST['edit'])) {
  25. if (!hasPermissions('adv', 'edit_user')) {
  26. exit();
  27. }
  28.  
  29. $rArray = getUser($_POST['edit']);
  30. if ($rArray['is_mag'] && !hasPermissions('adv', 'edit_mag')) {
  31. exit();
  32. }
  33. if ($rArray['is_e2'] && !hasPermissions('adv', 'edit_e2')) {
  34. exit();
  35. }
  36.  
  37. unset($rArray['id']);
  38. }
  39. else {
  40. if (!hasPermissions('adv', 'add_user')) {
  41. exit();
  42. }
  43.  
  44. $rArray = [
  45. 'member_id' => 0,
  46. 'username' => '',
  47. 'password' => '',
  48. 'exp_date' => NULL,
  49. 'admin_enabled' => 1,
  50. 'enabled' => 1,
  51. 'admin_notes' => '',
  52. 'reseller_notes' => '',
  53. 'bouquet' => [],
  54. 'max_connections' => 1,
  55. 'is_restreamer' => 0,
  56. 'allowed_ips' => [],
  57. 'allowed_ua' => [],
  58. 'created_at' => time(),
  59. 'created_by' => -1,
  60. 'is_mag' => 0,
  61. 'is_e2' => 0,
  62. 'force_server_id' => 0,
  63. 'is_isplock' => 0,
  64. 'isp_desc' => '',
  65. 'forced_country' => '',
  66. 'is_stalker' => 0,
  67. 'bypass_ua' => 0,
  68. 'play_token' => ''
  69. ];
  70. }
  71.  
  72. if (strlen($_POST['username']) == 0) {
  73. $_POST['username'] = generateString(12);
  74. }
  75.  
  76. if (strlen($_POST['password']) == 0) {
  77. $_POST['password'] = generateString(12);
  78. }
  79.  
  80. if (!isset($_POST['edit'])) {
  81. $result = $db->query('SELECT `id` FROM `users` WHERE `username` = \'' . ESC($_POST['username']) . '\';');
  82. if ($result && (0 < $result->num_rows)) {
  83. $_STATUS = 3;
  84. }
  85. }
  86. if (($_POST['is_mag'] && !filter_var($_POST['mac_address_mag'], FILTER_VALIDATE_MAC)) || ((0 < strlen($_POST['mac_address_e2'])) && !filter_var($_POST['mac_address_e2'], FILTER_VALIDATE_MAC))) {
  87. $_STATUS = 4;
  88. }
  89. else if ($_POST['is_mag']) {
  90. $result = $db->query('SELECT `user_id` FROM `mag_devices` WHERE mac = \'' . ESC(base64_encode($_POST['mac_address_mag'])) . '\' LIMIT 1;');
  91. if ($result && (0 < $result->num_rows)) {
  92. if (isset($_POST['edit'])) {
  93. if (intval($result->fetch_assoc()['user_id']) != intval($_POST['edit'])) {
  94. $_STATUS = 5;
  95. }
  96. }
  97. else {
  98. $_STATUS = 5;
  99. }
  100. }
  101. }
  102. else if ($_POST['is_e2']) {
  103. $result = $db->query('SELECT `user_id` FROM `enigma2_devices` WHERE mac = \'' . ESC($_POST['mac_address_e2']) . '\' LIMIT 1;');
  104. if ($result && (0 < $result->num_rows)) {
  105. if (isset($_POST['edit'])) {
  106. if (intval($result->fetch_assoc()['user_id']) != intval($_POST['edit'])) {
  107. $_STATUS = 5;
  108. }
  109. }
  110. else {
  111. $_STATUS = 5;
  112. }
  113. }
  114. }
  115.  
  116. foreach (['max_connections', 'enabled', 'admin_enabled'] as $rSelection) {
  117. if (isset($_POST[$rSelection])) {
  118. $rArray[$rSelection] = intval($_POST[$rSelection]);
  119. unset($_POST[$rSelection]);
  120. }
  121. else {
  122. $rArray[$rSelection] = 1;
  123. }
  124. }
  125.  
  126. foreach (['is_stalker', 'is_e2', 'is_mag', 'is_restreamer', 'is_trial'] as $rSelection) {
  127. if (isset($_POST[$rSelection])) {
  128. $rArray[$rSelection] = 1;
  129. unset($_POST[$rSelection]);
  130. }
  131. else {
  132. $rArray[$rSelection] = 0;
  133. }
  134. }
  135.  
  136. $rArray['bouquet'] = sortArrayByArray(array_values(json_decode($_POST['bouquets_selected'], true)), array_keys(getBouquetOrder()));
  137. $rArray['bouquet'] = '[' . join(',', $rArray['bouquet']) . ']';
  138. unset($_POST['bouquets_selected']);
  139. if (isset($_POST['exp_date']) && !isset($_POST['no_expire'])) {
  140. if ((0 < strlen($_POST['exp_date'])) && ($_POST['exp_date'] != '1970-01-01')) {
  141. try {
  142. $rDate = new DateTime($_POST['exp_date']);
  143. $rArray['exp_date'] = $rDate->format('U');
  144. }
  145. catch (Exception $e) {
  146. echo 'Incorrect date.';
  147. $_STATUS = 1;
  148. }
  149. }
  150.  
  151. unset($_POST['exp_date']);
  152. }
  153. else {
  154. $rArray['exp_date'] = NULL;
  155. }
  156.  
  157. if (isset($_POST['allowed_ips'])) {
  158. if (!is_array($_POST['allowed_ips'])) {
  159. $_POST['allowed_ips'] = [$_POST['allowed_ips']];
  160. }
  161.  
  162. $rArray['allowed_ips'] = json_encode($_POST['allowed_ips']);
  163. }
  164. else {
  165. $rArray['allowed_ips'] = '[]';
  166. }
  167.  
  168. if (isset($_POST['allowed_ua'])) {
  169. if (!is_array($_POST['allowed_ua'])) {
  170. $_POST['allowed_ua'] = [$_POST['allowed_ua']];
  171. ....................................................................
  172. ............................................
  173. ....................
Add Comment
Please, Sign In to add comment