<?php
### Brainy Control Panel
### Decoded IonCube by pimnik98
### Декодировал Пиминов Никита
### vk.com/piminov_remont
### Скрипт скачан с портала X-Scripts.Ru
error_reporting(0);
require_once "/etc/brainy/conf/globals.php";
require_once "/etc/brainy/classes/server.php";
ini_set("max_execution_time", "1000");
$server = new server();
if ($_SERVER["REQUEST_METHOD"] == "GET") {
$data = htmlspecialchars($_GET["data"]);
$num_qw = substr($data, -1);
$str_decode_solt = preg_replace("/.{1}\$/i", "", $data);
for ($i = 0; $i < $num_qw; $i++) {
$str_decode_solt .= "=";
}
$str_decode_solt = base64_decode($str_decode_solt);
$str_decode_solt = preg_replace("/^.{10}/i", "", $str_decode_solt);
$data = base64_decode($str_decode_solt);
list($email, $redirect, $name_file, $path_user, $user) = explode("|", $data);
$grep_file = $name_file;
$name_file = str_replace("create_", "statistic_", $name_file);
$server->ssh("sed -i \"\$(cat -n " . (string) $path_user . "/" . $grep_file . " | grep '" . $email . ",' | awk '{print \$1}')s/[0]\$/1/g\" " . (string) $path_user . "/" . $grep_file);
$out_stat = $server->ssh("cat " . $path_user . "/" . $grep_file . " | grep -Eo '[0-9]+\$'");
$sum = 0;
foreach ($out_stat as $val_stat) {
if ($val_stat) {
$sum += 1;
}
}
if (!is_file((string) $path_user . "/" . $name_file)) {
$array["open"] = 1;
$array[$redirect] = 1;
$server->config_save((string) $path_user . "/" . $name_file, $array, "new", $user);
} else {
$array = $server->config_read((string) $path_user . "/" . $name_file);
if (array_key_exists($redirect, $array)) {
$array[$redirect] += 1;
} else {
$array[$redirect] = 1;
}
$array["open"] = $sum;
$server->config_save((string) $path_user . "/" . $name_file, $array, "new", $user);
}
if (!preg_match("/(http)+/i", $redirect)) {
$redirect = "http://" . $redirect;
}
header("Location: " . $redirect, true, 302);
}
?>