Размер файла: 2.19Kb
<?
ini_set('session.use_cookies',1);
ini_set('session.cookie_lifetime', 604800);
ini_set('session.use_trans_sid',1);
ini_set('url_rewriter.tags',",");
session_start();
include $path.'/manage/config.php';
include($path.'/include/functions.php');
$db=@mysql_connect($conf['host'], $config['db_user'], $config['db_pass']) or die('Невозможно подключиться к серверу MySQL: '.mysql_error());
@mysql_select_db($config['db_name']) or die('Не могу подключиться к БД');
sql_query("SET NAMES `utf8`,collation_connection=`utf8_general_ci`,collation_server=`utf8_general_ci`,character_set_client=`utf8`,character_set_connection=`utf8`,character_set_results=`utf8`,character_set_server=`utf8`");
define ('PRE', $config['prefix']);
//error_reporting((!isset($config["erreport"]) || $config["erreport"]!=1)?0:E_ALL);
if(isset($_GET['log']) && isset($_GET['pas'])){ // АВТОРИЗАЦИЯ ЧЕРЕЗ КОМАНДНУЮ СТРОКУ
if(isset($_GET['pas']) && !preg_match('/[^0-9a-z]/i',$_GET['pas']) && $_GET['pas']!='') {
if(($dat=get_user_data(filtr(MyDecode($_GET['log']))))!=false && $dat['password']==md5($_GET['pas'])){
session_register('Alog');
session_register('Apass');
$_SESSION['Alog']=$dat['login'];
$_SESSION['Apass']=$dat['password'];
sql_query('UPDATE `'.PRE.'users` SET `lastin`='.time().', `agent`="'.filtr($_SERVER['HTTP_USER_AGENT']).'", `ip`="'.$_SERVER["REMOTE_ADDR"].'" WHERE `login`="'.$dat['login'].'"');
}
}
}
if(session_is_registered('Alog') && session_is_registered('Apass')) {
$dat=get_user_data($_SESSION['Alog']);
if($dat!=false && $dat['password']==$_SESSION['Apass'])
{
$user=$dat;
$rank=$dat['rank'];
if($user['ban_from']!='')
{
if($user['ban_time']-time()>0)
{
$ban['moder']=$user['ban_from'];
$ban['cause']=$user['ban_comment'];
$ban['time']=$user['ban_time'];
$ban['date']=$user['ban_date'];
header('Location: ban.php');
}else sql_query('UPDATE `'.PRE.'users` SET `ban_from`="" WHERE `login`="'.$user['login'].'"');
}
}
}
if(!isset($ban))$ban=FALSE;
?>