<?php
#############################################
# 0JXRgdC70Lgg0YLRiyDRh9C40YLQsNC10YjRjCDRj #
# dGC0L4g0YHQvtC+0LHRidC10L3QuNC1LCDQt9C90L #
# DRh9C40YIg0YLRiyDQvdC10LzQvdC+0LPQviDQt9C #
# 90LDQtdGI0YwgUEhQIQ== #
#__---------------------------------------__#
#__ 0JrQu9C40Log0JrQu9GD0LE= __#
# --------------------------------------- #
# 0JDQstGC0L7RgCA6IE1vcmdhbg== #
# SUNRIDog0L3QtSDRgdC60LDQttGDIHhE #
# #
#############################################
if($config['time_life_cookies'] > 0 && empty($_SESSION['auth']['login']) && empty($_SESSION['auth']['pass']) && !empty($_COOKIE['auth_login']) && !empty($_COOKIE['auth_pass']) && $_SERVER['SCRIPT_NAME'] != '/menu/exit.php')
{
$_login = obr(base64_decode(strrev(base64_decode($_COOKIE['auth_login']))),'string',30);
$_password = obr(base64_decode(strrev(base64_decode($_COOKIE['auth_pass']))),'string',32);
$res = query("SELECT * FROM `$db[prefix]users` WHERE `login`='$_login'");
if(mysql_num_rows($res)>0)
{
$user_prof = mysql_fetch_array($res);
if($_login === $user_prof['login'] && $_password === $user_prof['pass'])
{
$_SESSION['auth']['login'] = $_login ;
$_SESSION['auth']['pass'] = $_password ;
$_SESSION['auth']['secret_code'] = md5(substr($_ua,-15).substr($_ip,-3).$config['salt'].$user_prof['login']);
}else {setcookie('auth_login','',0,'/'); setcookie('auth_pass','',0,'/'); session_destroy(); unset($user_prof,$_login,$_pass); $user_prof['id']=0;}
}else{setcookie('auth_login','',0,'/'); setcookie('auth_pass','',0,'/'); session_destroy(); unset($_login,$_pass); $user_prof['id']=0;}
}
/*
echo '<b>SESSION</b> : <br/>';
array_dump($_SESSION);
echo '<b>COOKIE</b> : <br/>';
array_dump($_COOKIE);
*/
#echo $_SERVER['SCRIPT_NAME'];
$user_in_site = 0;
//-- SESSION
if(isset($_SESSION['auth']['secret_code']) && !empty($_SESSION['auth']['login'])&& !empty($_SESSION['auth']['pass']))
{
$_login = obr($_SESSION['auth']['login'],'string',30);
$_password = obr($_SESSION['auth']['pass'],'string',32);
$res = query("SELECT * FROM `$db[prefix]users` WHERE `login`='$_login'");
if(mysql_num_rows($res)>0)
{
$user_prof = mysql_fetch_array($res);
if($_login === $user_prof['login'] && $_password === $user_prof['pass'])
{
$code = md5(substr($_ua,-15).substr($_ip,-3).$config['salt'].$user_prof['login']);
if($_SESSION['auth']['secret_code']==$code)
{
$user_in_site = 1;
}else { session_destroy(); unset($user_prof,$_login,$_pass,$_SESSION['auth']) ;$user_prof['id']=0;}
}else { session_destroy(); unset($user_prof,$_login,$_pass,$_SESSION['auth']); $user_prof['id']=0;}
}else{ session_destroy(); unset($_login,$_pass,$_SESSION['auth']);$user_prof['id']=0;}
}
else
{
$user_prof['id'] = 0;
$user_prof['admin'] = 0;
$user_prof['set_econom_traf'] = 0;
}
#*/
//--------------------------------- Для зарегистрированых пользователей ------------------------------------\\
if($user_in_site == 1)
{
if($user_prof['active']!= 1){unset($_login,$_pass,$user_prof); session_destroy(); location('index.php');}
#if($user_prof['set_econom_traf']==0){ob_start('disable_img');}
#if(empty($_SESSION['time'])){$_SESSION['time'] = 0;}
#array_dump($_SESSION);
//------ Если пользователь забанен
if(is_ban($user_prof['id']))
{
if($_script_name != '/ban.php')
{
location('ban.php');
}
}
//------ Требуется ввести код
if(empty($_SESSION['auth']['code']) && $config['antispam_bot_code'] > 0)
{
if($_script_name != '/aut.php' && $_script_name != '/inc/captcha.php')
{
location('aut.php');
}
}
//-- Механизм бана 'мошеников'
if(!isset($_SESSION['clicks']) || $_SESSION['clicks']==''){$_SESSION['clicks'] = 0;}
if($_SESSION['clicks']>=$config['clicks_for_ban'])
{
query("INSERT INTO `$db[prefix]ban` SET `reason`='$config[reason]',`who`='$user_prof[id]',`date`=".($sitetime + $config['time_ban_clicks']).",`id_mod`='1'");
$_SESSION['clicks'] = 0;
location('ban.php');
}
//------ Элементов на страницу
if(!empty($user_prof['set_on_page']))
{
$set_on_page = $user_prof['set_on_page'];
}else
{ query("UPDATE `$db[prefix]users` SET `set_on_page`='$config[on_page]' WHERE `id`='$user_prof[id]'"); $set_on_page = $config['on_page'];}
//------ Дизайн
// WEB
if($web_brows==true)
{
if(!empty($user_prof['set_style_web']) && filetype(D.'style/'.$user_prof['set_style_web'])=='dir' && file_exists(D.'style/'.$user_prof['set_style_web'].'/style.css'))
{
$set_style = $user_prof['set_style_web'];
}else
{ query("UPDATE `$db[prefix]users` SET `set_style_web`='$config[style_web]' WHERE `id`='$user_prof[id]'"); $set_style = $config['style_web'];}
// WAP
}else
{
if(!empty($user_prof['set_style_wap']) && filetype(D.'style/'.$user_prof['set_style_wap'])=='dir' && file_exists(D.'style/'.$user_prof['set_style_wap'].'/style.css'))
{
$set_style = $user_prof['set_style_wap'];
}else
{ query("UPDATE `$db[prefix]users` SET `set_style_wap`='$config[style_wap]' WHERE `id`='$user_prof[id]'"); $set_style = $config['style_wap'];}
}
// Тип просмотра ссылок на юзеров
$mfvl = ($user_prof['admin']>=2) ? 'admin' : 'user';
}
//-- Постр. навигация
if(isset($_GET['page']))
{ $page = obr($_GET['page'],'integer');
if($page == 0) $page = 1;}
else { $page = 1; }
$p_str = ($set_on_page*$page)-$set_on_page;
if(empty($_SESSION['traffick'])) {$_SESSION['traffick'] = 0;} //-- Вспомогательное для учета трафа
if(!isset($_SESSION['referal'])) $_SESSION['referal'] = 0;
if(isset($_GET['ref'])) {$_SESSION['referal'] = abs(intval($_GET['ref']));} //-- Вспомогательное для реф. программы
# /*
if(empty($off_hh))
{
if($config['logs_hosts']==1)
{
//------------- Подсчет посещаемости
//---сегодня хостов
$res = query("SELECT * FROM `$db[prefix]counter_data` WHERE `date`='$day_all'");
$_s_referer = ($_http_referer!='' && stripos($_http_referer,$_host)===false) ? $_http_referer : '';
if(mysql_num_rows($res)>0)
{
$counter = mysql_fetch_array($res);
$res1 = query("SELECT id FROM `$db[prefix]counter_hosts_hits` WHERE `ip`='$_ip' AND `ua`='$_ua' AND `date`='$day_all' ");
if(mysql_num_rows($res1)>0)
{
$counter['hits'] ++;
query("UPDATE `$db[prefix]counter_data` SET `hits`='$counter[hits]' WHERE `date`='$day_all'");
query("UPDATE `$db[prefix]counter_hosts_hits` SET `hits`=hits+1 , `time` = '$sitetime',`lastpage`='$_request_uri' , `referer`='$_s_referer' , `user`='$user_prof[id]' WHERE `ip` = '$_ip' AND `ua`='$_ua' AND `date`='$day_all'");
if($config['logs_hosts_pages']==1){
query("INSERT INTO `$db[prefix]counter_visited_pages` SET `id_host`=".mysql_result($res1,0).",`time`='$sitetime',`page`='$_request_uri'");}
}
else
{
$counter['hosts'] ++;
$counter['hits'] ++;
query("UPDATE `$db[prefix]counter_data` SET `hits`='$counter[hits]',`hosts`='$counter[hosts]' WHERE `date`='$day_all'");
query("INSERT INTO `$db[prefix]counter_hosts_hits` SET `ip`='$_ip',`ua`='$_ua' , `referer`='$_s_referer' , `date`='$day_all' ,`hits`='1' , `time` = '$sitetime',`lastpage`='$_request_uri',`user`='$user_prof[id]'");
if($config['logs_hosts_pages']==1){
query("INSERT INTO `$db[prefix]counter_visited_pages` SET `id_host`=".mysql_insert_id().",`time`='$sitetime',`page`='$_request_uri'");}
}
}else
{
$counter = array('hosts'=>1,'hits'=>1);
query("INSERT `$db[prefix]counter_data` SET `hosts`='1',`hits`='1',`date`='$day_all'");
query("INSERT INTO `$db[prefix]counter_hosts_hits` SET `ip`='$_ip' , `ua`='$_ua' ,`referer`='$_s_referer' , `date`='$day_all' ,`hits`='1',`lastpage`='$_request_uri',`user`='$user_prof[id]'");
if($config['logs_hosts_pages']==1){
query("INSERT INTO `$db[prefix]counter_visited_pages` SET `id_host`=".mysql_insert_id().",`time`='$sitetime',`page`='$_request_uri'");}
}
}else{$counter= array('hosts'=>'<u>Счетчик отключен!</u>','hits'=>'<u>Счетчик отключен!</u>');}
$res2 = query("SELECT id FROM `$db[prefix]clicks_counter` WHERE `date`='$day_all'");
if(mysql_num_rows($res2)==0)
{
query("INSERT INTO `$db[prefix]clicks_counter` SET `date`='$day_all'");
}
# */
//-- Необходимая работа с БД
query("DELETE FROM `$db[prefix]online` WHERE `time`+'$config[time_of_a_life]' < '$sitetime' OR (`ip` = '$_ip' AND `ua`='$_ua') ");
#query("DELETE FROM `$db[prefix]online` WHERE ");
query("INSERT INTO `$db[prefix]online` SET `ip` = '$_ip',`time`='$sitetime',`id_user`='$user_prof[id]',`where`='$_request_uri',`ua`='$_ua'");
query("DELETE FROM `$db[prefix]ban` WHERE `date` < '$sitetime'");
query("DELETE FROM `$db[prefix]antispam` WHERE `time` < '$sitetime'");
query("DELETE FROM `$db[prefix]reklama` WHERE `do` < '$sitetime'");
query("DELETE FROM `$db[prefix]users_reklama` WHERE `do` < '$sitetime'");
query("DELETE FROM `$db[prefix]search` WHERE `time`+ 1000 < '$sitetime' ");
query("DELETE FROM `$db[prefix]banip` WHERE `do`<'$sitetime'");
}
if($user_in_site == 1)
{
//-- Защита от недопереходов
if(!isset($_SESSION['cl']) || !is_array($_SESSION['cl']))$_SESSION['cl'] = array();
foreach($_SESSION['cl'] as $key=>$value)
{
if(($sitetime - $value ) < $config['interval_trans'])
{
query("UPDATE `$db[prefix]clicks` SET `was` = '-1' WHERE `whom` = '$key' AND `date` = '$day_all' AND `who` = '$user_prof[id]'");
$_SESSION['clicks'] ++;
query("UPDATE `$db[prefix]users` SET `bad_trans` = `bad_trans` + 1 WHERE `id`='$user_prof[id]' ");
$title = 'Переход по ссылкам';
if($user_prof['credits'] >= $config['price_bad_trans'])$field = 'credits';
elseif($user_prof['in_bank'] >= $config['price_bad_trans'])$field = 'in_bank';
if(isset($field))query("UPDATE `$db[prefix]users` SET `$field` = `$field` - '$config[price_bad_trans]' WHERE `id`='$user_prof[id]' ");
require D.'inc/head.php';
echo '<div class="sec">
Ошибка
</div><div class="vstavka">
Вы слишком часто переходите по ссылкам!<br />
Интервал составляет <b>'.$config['interval_trans'].'</b> сек!<br />';
if(isset($field))echo 'За недопереход, с вашего счета списано <b>'.$config['price_bad_trans'].'</b> '.postfix($config['price_bad_trans']).'!<br />';
echo 'Если вы будете еще переходить слишком часто, вы будете забанены!<br />';
require D.'inc/foot.php';
}
else
{
# echo mysql_result(query("SELECT user FROM `$db[prefix]sites` WHERE `id` = ''"),0);
// процент от реферала
if($user_prof['ref']!=0)
{
query("UPDATE `$db[prefix]users` SET `credits` = `credits` + $config[ref_prem] WHERE `id`= '$user_prof[ref]'");
}
// берем бабки у юзера за переход
query("UPDATE `$db[prefix]users` SET `credits` = credits - $config[receivecredits_usualclick],`trans_to` = `trans_to` + 1 WHERE `id`='".mysql_result(query("SELECT user FROM `$db[prefix]sites` WHERE `id` = '$key'"),0)."'");
query("UPDATE `$db[prefix]users` SET `credits` = credits + $config[receivecredits_usualclick],`trans_from` = `trans_from` + 1 WHERE `id`='$user_prof[id]'");
query("UPDATE `$db[prefix]clicks` SET `was` = '".($sitetime - $value)."' WHERE `whom` = '$key' AND `date` = '$day_all' AND `who` = '$user_prof[id]'");
}
unset($_SESSION['cl'][$key]);
}
}
#var_dump(exec("mysqldump --user=user --password=12345 --opt --all-databases > D:\all_databases.sql"));
#var_dump(exec("mysqldump --help"));
################################################
# 0KHQutGA0LjQv9GCINC90LUg0L/QsNCx0LvQuNC6IQ== #
# 0KHRgtCw0LLRgNC+0L/QvtC70YwsIDIwMDkg0LMu #
################################################
?>