Файл: 4wx.ru/isp/index.php
Строк: 239
<?php
$microtime = microtime(1);
$server = '195.88.209.248';
$session_lifetime = 1800;
// ----------------------------------- ÐÑлаЎка -------------------------------- //
error_reporting(32767);
ini_set('display_errors', 0);
// ----------------------------------- ÐÑлаЎка -------------------------------- //
// ------------------------- УÑÑаМПвкО ÑабПÑÑ Ñ ÑеÑÑОÑЌО ---------------------- //
ini_set('arg_separator.output', '&');
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');
// ------------------------- УÑÑаМПвкО ÑабПÑÑ Ñ ÑеÑÑОÑЌО ---------------------- //
// ------------- ЀÑМкÑÐžÑ Ð·Ð°Ð¿ÑПÑа к API, пÑПвеÑка ОÑÑеÑÐµÐœÐžÑ ÑеÑÑОО ------------- //
function api_query($query)
{
$content = file_get_contents($query);
if (strpos($content, 'Authorization required') or $content == '') {
session_unset();
session_destroy();
header('Location: ?error=logon');
ob_end_flush();
exit();
} else {
return $content;
}
}
// ------------- ЀÑМкÑÐžÑ Ð·Ð°Ð¿ÑПÑа к API, пÑПвеÑка ОÑÑеÑÐµÐœÐžÑ ÑеÑÑОО ------------- //
// ------------------- ÐÑÑеÑОзаÑÐžÑ Ð²ÑвПЎа О ÑжаÑОе ЎПкÑЌеМÑа ------------------ //
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$accept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
} elseif (isset($_SERVER['HTTP_TE'])) {
$accept_encoding = $_SERVER['HTTP_TE'];
} else {
$accept_encoding = '';
}
if (strpos($accept_encoding, 'gzip')) {
header('Content-Encoding: gzip');
function gzencode5($data)
{
return gzencode($data, 5);
}
ob_start('gzencode5');
} elseif (strpos($accept_encoding, 'deflate')) {
header('Content-Encoding: deflate');
function gzdeflate5($output)
{
return gzdeflate($output, 5);
}
ob_start('gzdeflate5');
} else {
ob_start();
}
// ------------------- ÐÑÑеÑОзаÑÐžÑ Ð²ÑвПЎа О ÑжаÑОе ЎПкÑЌеМÑа ------------------ //
session_start();
$func = isset($_GET['func']) ? $_GET['func'] : '';
// ---------------------- ÐÑПвеÑка ЎейÑÑвОÑелÑМПÑÑО ÑеÑÑОО -------------------- //
/*if ($func <> '' and $func <> 'exit') {
if (empty($_SESSION['auth']) or empty($_SESSION['lifetime']) or empty($_SESSION['username']) or empty($_SESSION['password'])) {
session_unset();
session_destroy();
header('Location: ?error=logon');
ob_end_flush();
exit();
} elseif ($_SESSION['auth'] == '' or $_SESSION['lifetime'] == '' or $_SESSION['username'] == '' or $_SESSION['password'] == '') {
session_unset();
session_destroy();
header('Location: ?error=logon');
ob_end_flush();
exit();
} elseif ($_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'];
}
}*/
// ---------------------- ÐÑПвеÑка ЎейÑÑвОÑелÑМПÑÑО ÑеÑÑОО -------------------- //
// --------------------------- ÐÑклÑÑеМОе кÑÑОÑÐŸÐ²Ð°ÐœÐžÑ ------------------------- //
#header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0');
#header('Pragma: no-cache');
#header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
#header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// --------------------------- ÐÑклÑÑеМОе кÑÑОÑÐŸÐ²Ð°ÐœÐžÑ ------------------------- //
// -------------------- ÐÑпÑавка загПлПвка Ñ ÑОпПЌ ЎПкÑЌеМÑа ------------------ //
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 "nn";
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>4WX.Ru WAP-ISP</title>' . "n";
echo '<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=UTF-8" />' . "n";
echo '<meta name="viewport"
content= "width=device-width, initial-
scale=1.0" />' . "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";
echo '<div class="head"><a href="/">' . "n";
echo '<img src="../style/logo6.png" alt="ISPmanager" />' . "n";
echo '</a></div>' . "n";
if ($func == '') {
echo '<div style="text-align:center">' . "n";
if (empty($_POST['submit']) and (empty($_GET['username']) or empty($_GET['password']))) {
if (isset($_GET['error'])) {
if ($_GET['error'] == 'logon') {
echo 'Ошибка входа!<br />' . "n";
echo '<br />' . "n";
} elseif ($_GET['error'] == 'authfail') {
echo 'Ошибка входа!<br />' . "n";
echo '<br />' . "n";
} elseif ($_GET['error'] == 'expire') {
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']) and isset($_GET['password'])) {
header('Location: ?func=menu&' . SID);
ob_end_flush();
exit;
}
echo 'Успешная авторизация!<br />' . "n";
echo '<a href="?func=menu">Перейти в меню</a>' . "n";
} else {
session_unset();
session_destroy();
header('Location: ?error=authfail');
ob_end_flush();
exit();
}
}
echo '</div>' . "n";
} elseif (file_exists('./func/' . $func . '.php')) {
require('./func/' . $func . '.php');
} else {
session_unset();
session_destroy();
header('Location: ?error=logon');
ob_end_flush();
exit();
}
echo '' . "n";
echo '<div style="text-align:center" class="post">' . "n";
echo '<font color="#FFFFFF">© <a href="http://4wx.ru/"><font color="#FFFFFF">4WX.Ru</font></a></font>';
if (date('Y') <> '2010') {
//echo '-' . date('Y');
}
echo "n";
echo '</div>' . "n";
echo '</body>' . "n";
echo '</html>' . "n";
echo "n";
ob_end_flush();
?>