Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- include 'session.php';
- include 'functions.php';
- if (!$rPermissions['is_admin'] || (!hasPermissions('adv', 'add_user') && !hasPermissions('adv', 'edit_user'))) {
- exit();
- }
- if (isset($_POST['submit_user'])) {
- $_POST['mac_address_mag'] = strtoupper($_POST['mac_address_mag']);
- $_POST['mac_address_e2'] = strtoupper($_POST['mac_address_e2']);
- if (isset($_POST['edit'])) {
- if (!hasPermissions('adv', 'edit_user')) {
- exit();
- }
- $rArray = getUser($_POST['edit']);
- if ($rArray['is_mag'] && !hasPermissions('adv', 'edit_mag')) {
- exit();
- }
- if ($rArray['is_e2'] && !hasPermissions('adv', 'edit_e2')) {
- exit();
- }
- unset($rArray['id']);
- }
- else {
- if (!hasPermissions('adv', 'add_user')) {
- exit();
- }
- $rArray = [
- 'member_id' => 0,
- 'username' => '',
- 'password' => '',
- 'exp_date' => NULL,
- 'admin_enabled' => 1,
- 'enabled' => 1,
- 'admin_notes' => '',
- 'reseller_notes' => '',
- 'bouquet' => [],
- 'max_connections' => 1,
- 'is_restreamer' => 0,
- 'allowed_ips' => [],
- 'allowed_ua' => [],
- 'created_at' => time(),
- 'created_by' => -1,
- 'is_mag' => 0,
- 'is_e2' => 0,
- 'force_server_id' => 0,
- 'is_isplock' => 0,
- 'isp_desc' => '',
- 'forced_country' => '',
- 'is_stalker' => 0,
- 'bypass_ua' => 0,
- 'play_token' => ''
- ];
- }
- if (strlen($_POST['username']) == 0) {
- $_POST['username'] = generateString(12);
- }
- if (strlen($_POST['password']) == 0) {
- $_POST['password'] = generateString(12);
- }
- if (!isset($_POST['edit'])) {
- $result = $db->query('SELECT `id` FROM `users` WHERE `username` = \'' . ESC($_POST['username']) . '\';');
- if ($result && (0 < $result->num_rows)) {
- $_STATUS = 3;
- }
- }
- 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))) {
- $_STATUS = 4;
- }
- else if ($_POST['is_mag']) {
- $result = $db->query('SELECT `user_id` FROM `mag_devices` WHERE mac = \'' . ESC(base64_encode($_POST['mac_address_mag'])) . '\' LIMIT 1;');
- if ($result && (0 < $result->num_rows)) {
- if (isset($_POST['edit'])) {
- if (intval($result->fetch_assoc()['user_id']) != intval($_POST['edit'])) {
- $_STATUS = 5;
- }
- }
- else {
- $_STATUS = 5;
- }
- }
- }
- else if ($_POST['is_e2']) {
- $result = $db->query('SELECT `user_id` FROM `enigma2_devices` WHERE mac = \'' . ESC($_POST['mac_address_e2']) . '\' LIMIT 1;');
- if ($result && (0 < $result->num_rows)) {
- if (isset($_POST['edit'])) {
- if (intval($result->fetch_assoc()['user_id']) != intval($_POST['edit'])) {
- $_STATUS = 5;
- }
- }
- else {
- $_STATUS = 5;
- }
- }
- }
- foreach (['max_connections', 'enabled', 'admin_enabled'] as $rSelection) {
- if (isset($_POST[$rSelection])) {
- $rArray[$rSelection] = intval($_POST[$rSelection]);
- unset($_POST[$rSelection]);
- }
- else {
- $rArray[$rSelection] = 1;
- }
- }
- foreach (['is_stalker', 'is_e2', 'is_mag', 'is_restreamer', 'is_trial'] as $rSelection) {
- if (isset($_POST[$rSelection])) {
- $rArray[$rSelection] = 1;
- unset($_POST[$rSelection]);
- }
- else {
- $rArray[$rSelection] = 0;
- }
- }
- $rArray['bouquet'] = sortArrayByArray(array_values(json_decode($_POST['bouquets_selected'], true)), array_keys(getBouquetOrder()));
- $rArray['bouquet'] = '[' . join(',', $rArray['bouquet']) . ']';
- unset($_POST['bouquets_selected']);
- if (isset($_POST['exp_date']) && !isset($_POST['no_expire'])) {
- if ((0 < strlen($_POST['exp_date'])) && ($_POST['exp_date'] != '1970-01-01')) {
- try {
- $rDate = new DateTime($_POST['exp_date']);
- $rArray['exp_date'] = $rDate->format('U');
- }
- catch (Exception $e) {
- echo 'Incorrect date.';
- $_STATUS = 1;
- }
- }
- unset($_POST['exp_date']);
- }
- else {
- $rArray['exp_date'] = NULL;
- }
- if (isset($_POST['allowed_ips'])) {
- if (!is_array($_POST['allowed_ips'])) {
- $_POST['allowed_ips'] = [$_POST['allowed_ips']];
- }
- $rArray['allowed_ips'] = json_encode($_POST['allowed_ips']);
- }
- else {
- $rArray['allowed_ips'] = '[]';
- }
- if (isset($_POST['allowed_ua'])) {
- if (!is_array($_POST['allowed_ua'])) {
- $_POST['allowed_ua'] = [$_POST['allowed_ua']];
- ....................................................................
- ............................................
- ....................
Add Comment
Please, Sign In to add comment