Просмотр файла ISP4Mobile/index.php

Размер файла: 5.95Kb
<?php
### Decoded IonCube by pimnik98 
### Декодировал Пиминов Никита 
### vk.com/piminov_remont
### Заказать декодирование: https://bymas.ru/forum/viewtopic.php?topic_id=131647

function api_query($query)
{
	$content = file_get_contents($query);
	if (strpos($content, 'Authorization required') || ($content == '')) {
		session_unset();
		session_destroy();
		header('Location: ?error=logon');
		ob_end_flush();
		exit();
		return NULL;
	}

	return $content;
}

$proverys = 'xrexxuivam';
$microtime = microtime(1);
include 'config.php';
$server = $xrex;
$session_lifetime = 1800;
error_reporting(32767);
ini_set('display_errors', 1);
ini_set('arg_separator.output', '&amp;');
ini_set('session.use_cookies', 1);
ini_set('session.use_trans_sid', 1);
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
ini_set('session.cookie_httponly', 1);
session_name('SID');

if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
	$accept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
}
else if (isset($_SERVER['HTTP_TE'])) {
	$accept_encoding = $_SERVER['HTTP_TE'];
}
else {
	$accept_encoding = '';
}

if (strpos($accept_encoding, 'gzip')) {
	function gzencode5($data)
	{
		return gzencode($data, 5);
	}
	header('Content-Encoding: gzip');
	ob_start('gzencode5');
}
else if (strpos($accept_encoding, 'deflate')) {
	function gzdeflate5($output)
	{
		return gzdeflate($output, 5);
	}
	header('Content-Encoding: deflate');
	ob_start('gzdeflate5');
}
else {
	ob_start();
}

session_start();
$func = (isset($_GET['func']) ? $_GET['func'] : '');

if (($func != '') && ($func != 'exit')) {
	if (empty($_SESSION['auth']) || empty($_SESSION['lifetime']) || empty($_SESSION['username']) || empty($_SESSION['password'])) {
		session_unset();
		session_destroy();
		header('Location: ?error=logon');
		ob_end_flush();
		exit();
	}
	else {
		if (($_SESSION['auth'] == '') || ($_SESSION['lifetime'] == '') || ($_SESSION['username'] == '') || ($_SESSION['password'] == '')) {
			session_unset();
			session_destroy();
			header('Location: ?error=logon');
			ob_end_flush();
			exit();
		}
		else if ($_SESSION['lifetime'] < ($_SERVER['REQUEST_TIME'] - $session_lifetime)) {
			session_unset();
			session_destroy();
			header('Location: ?error=expire');
			ob_end_flush();
			exit();
		}
		else {
			$_SESSION['lifetime'] = $_SERVER['REQUEST_TIME'];
		}
	}
}

if (isset($_SERVER['HTTP_ACCEPT'])) {
	if (strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
		header('Content-Type: application/xhtml+xml; charset=UTF-8');
	}
	else {
		header('Content-Type: text/html; charset=UTF-8');
	}
}
else {
	header('Content-Type: text/html; charset=UTF-8');
}

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">' . "\n";
echo '<head>' . "\n";
echo '<title>ISPmanager Mobile</title>' . "\n";
echo '<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />' . "\n";
echo '<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />' . "\n";
echo '<link rel="stylesheet" type="text/css" href="style.css" />' . "\n";
echo '</head>' . "\n";
echo '<body>' . "\n";

if ($func == '') {
	echo '<div class="head">' . "\n" . '<div class="logo"> Панель управления</div>' . "\n" . '</div><div class="menu">' . "\n";

	if (empty($_POST['submit']) && (empty($_GET['username']) || empty($_GET['password']))) {
		if (isset($_GET['error'])) {
			if ($_GET['error'] == 'logon') {
				echo 'Неизвестная ошибка.<br />' . "\n";
				echo 'Авторизуйтесь повторно!<br />' . "\n";
				echo '<br />' . "\n";
			}
			else if ($_GET['error'] == 'authfail') {
				echo 'Неверный пароль!<br />' . "\n";
				echo '<br />' . "\n";
			}
			else if ($_GET['error'] == 'expire') {
				echo 'Сессия устарела.<br />' . "\n";
				echo 'Авторизуйтесь повторно!<br />' . "\n";
				echo '<br />' . "\n";
			}
		}

		echo '<form action="index.php" method="post">' . "\n";
		echo 'Логин:<br />' . "\n";
		echo '<input name="username" /><br />' . "\n";
		echo 'Пароль:<br />' . "\n";
		echo '<input name="password" type="password" /><br />' . "\n";
		echo '<input name="submit" type="submit" value="Войти" />' . "\n";
		echo '</form>' . "\n";
	}
	else {
		$content = api_query('https://' . $server . '/manager/ispmgr?func=auth&out=xml&username=' . urlencode($_REQUEST['username']) . '&password=' . urlencode($_REQUEST['password']));
		$parse_xml = simplexml_load_string($content);

		if (isset($parse_xml->auth)) {
			$_SESSION['lifetime'] = $_SERVER['REQUEST_TIME'];
			$_SESSION['auth'] = (string) $parse_xml->auth;
			$_SESSION['username'] = $_REQUEST['username'];
			$_SESSION['password'] = $_REQUEST['password'];
			$content = api_query('https://' . $server . '/manager/ispmgr?func=usrparam&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
			$parse_xml_usrparam = simplexml_load_string($content);
			$_SESSION['rows'] = (int) $parse_xml_usrparam->rows;

			if (isset($_GET['username']) && isset($_GET['password'])) {
				header('Location: ?func=menu&' . SID);
				ob_end_flush();
				exit();
			}

			echo 'Авторизация успешна<br />' . "\n";
			echo '<a href="?func=menu">Продолжить&#187;</a>' . "\n";
			header('Location: ?func=menu');
		}
		else {
			session_unset();
			session_destroy();
			header('Location: ?error=authfail');
			ob_end_flush();
			exit();
		}
	}

	echo '</div>' . "\n";
}
else if (file_exists('./xrex/' . $func . '.php')) {
	require './xrex/' . $func . '.php';
}
else {
	session_unset();
	session_destroy();
	header('Location: ?error=logon');
	ob_end_flush();
	exit();
}

echo '<div class="end">' . "\n";
echo '&copy; <a href="vk.com/piminov_remont">DeCoded by pimnik98</a> 2o18';
echo '</div>';
echo '</body></html>';
ob_end_flush();

?>