Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function xorcoding($text, $key, $shift = 0, $type = "")
- {
- if ($type == "decode") {
- $text = base64_decode($text);
- }
- if (!is_array($shift)) {
- $shift = array($shift);
- }
- $v = (int) $v;
- $output = "";
- $klng = strlen($key);
- $tlng = strlen($text);
- $shlng = sizeof($shift);
- if ($type == "encode") {
- $i = 0;
- $j = 0;
- while ($i < $tlng) {
- if ($shlng <= $j) {
- $j = 0;
- }
- $code = ord($text[$i]) + $shift[$j];
- if (255 < $code) {
- $code -= 256;
- }
- if ($code < 0) {
- $code += 256;
- }
- $text[$i] = chr($code);
- ++$i;
- ++$j;
- }
- }
- $i = 0;
- $j = 0;
- while ($i < $tlng) {
- if ($klng <= $j) {
- $j = 0;
- }
- $output .= chr(ord($key[$j]) ^ ord($text[$i]));
- ++$i;
- ++$j;
- }
- if ($type == "decode") {
- $i = 0;
- $j = 0;
- while ($i < $tlng) {
- if ($shlng <= $j) {
- $j = 0;
- }
- $code = ord($output[$i]) - $shift[$j];
- if (255 < $code) {
- $code -= 256;
- }
- if ($code < 0) {
- $code += 256;
- }
- $output[$i] = chr($code);
- ++$i;
- ++$j;
- }
- }
- if ($type == "encode") {
- $output = base64_encode($output);
- }
- return $output;
- }
- session_start();
- require_once ("config.php");
- if (isset($_REQUEST["activate"]) && isset($_REQUEST["license"]) && $_REQUEST["license"]) {
- $php = file_get_contents("config.php");
- $php = str_replace("\$license = '';", "\$license = '" . $_REQUEST["license"] . "';", $php);
- file_put_contents("config.php", $php);
- header("Location: index.php");
- exit();
- }
- ob_start();
- phpinfo();
- $html = ob_get_contents();
- ob_end_clean();
- $parser = new Parser();
- $host = $parser->parse_string($html, "|<tr><td class=\"e\">HTTP_HOST </td><td class=\"v\">(.*?)</td></tr>|");
- if (!$host) {
- $host = $_SERVER["HTTP_HOST"] . " ";
- }
- $shift_scr = array(52, -61, 17, -92, 49);
- $shift_lic = array(48, 12, -10, 57, 29, -8);
- $key_scr = "kiui543hi73412fyhrt";
- $key_lic = "tyunkio7w435yujasduie";
- /*
- if ($license) {
- $license = xorcoding($license, $key_lic, $shift_lic, "decode");
- $hostl = $license;
- if ($hostl !== $host) {
- exit("Лицензия неверна!!! Лицензию для текущего домена можно сгенерировать в админке скрипта!");
- }
- }
- else {
- $key = $host . "$host";
- $key = xorcoding($key, $key_scr, $shift_scr, "encode");
- $smarty->assign("key", $key);
- $smarty->assign("host", $host);
- $errors = $application->check_perms(true);
- $smarty->assign("errors", $errors);
- $content = $smarty->fetch("activate.tpl");
- $smarty->assign("content", $content);
- $smarty->display("index.tpl");
- exit();
- }
- */
- $cms = new CMS("..");
- $log = (isset($_SESSION["login"]) ? $_SESSION["login"] : get_req_var("login"));
- if (isset($_SESSION["password"])) {
- $pass = $_SESSION["password"];
- }
- else {
- $pass = get_req_var("password");
- if ($cms->cms == "dle") {
- $pass = md5(md5($pass));
- }
- else if ($cms->cms == "drupal") {
- $pass = Drupal::password_hash($pass);
- }
- else {
- $pass = md5($pass);
- }
- }
- if ($log && $pass) {
- $auth = $cms->authorize_user($log, $pass);
- if ($auth) {
- $_SESSION["login"] = $log;
- $_SESSION["password"] = $pass;
- }
- else {
- $smarty->assign("error", "Неверная пара логин / пароль!");
- $content = $smarty->fetch("auth.tpl");
- $smarty->assign("content", $content);
- $smarty->display("index.tpl");
- exit();
- }
- }
- else {
- $smarty->assign("error", "");
- $content = $smarty->fetch("auth.tpl");
- $smarty->assign("content", $content);
- $smarty->display("index.tpl");
- exit();
- }
- $smarty->assign("menu", 1);
- $do = get_req_var("do", "settings");
- switch ($do) {
- case "settings":
- $cms = new CMS(ROOT . "/..");
- $cats = $cms->get_cats("video");
- $smarty->assign("cats", $cats);
- $smarty->assign("settings", $settings);
- $smarty->assign("page", "settings");
- $smarty->assign("page_title", "Настройки");
- $content = $smarty->fetch("settings.tpl");
- break;
- case "requests":
- $total = 0;
- $page = get_req_var("page", 1);
- $requests = $cms->driver->db->selectPage($total, "SELECT * FROM ?_requests LIMIT ?d, ?d", ($page - 1) * 100, 100);
- $smarty->assign("requests", $requests);
- $smarty->assign("pages", ceil($total / 100));
- $smarty->assign("cur_page", $page);
- $smarty->assign("page", "requests");
- $smarty->assign("page_title", "Запросы");
- $content = $smarty->fetch("requests.tpl");
- break;
- default:
- $smarty->assign("page", "");
- $smarty->assign("page_title", "");
- $content = $smarty->fetch("main.tpl");
- break;
- }
- $smarty->assign("content", $content);
- $smarty->display("index.tpl");
Advertisement
Add Comment
Please, Sign In to add comment