Файл: my.net.ru/system/connections/global/users.php
Строк: 61
<?php
/*
-----------------------
COOKIE + SESSION + SALT
-----------------------
*/
if (config('AUT_MODE') == 0){
$user = 0;
if (!session('salt')) {
if (!empty(cookie('USER_ID')) && !empty(cookie('PASSWORD'))) {
session('salt', base64_encode(cookie('USER_ID').','.cookie('PASSWORD')));
redirect(REQUEST_URI);
}
}else{
$ex_user = explode(',', base64_decode(session('salt')));
$user_id = intval(user_deshif($ex_user[0]));
$user_pass = esc(shif(cdecrypt($ex_user[1])));
if (db::get_column("SELECT COUNT(*) FROM `USERS` WHERE `ID` = ? AND `PASSWORD` = ? LIMIT 1", [$user_id, $user_pass]) > 0) {
$user = $user_id;
}
}
function user($data){
global $user;
$us = db::get_string("SELECT * FROM `USERS` WHERE `ID` = ? LIMIT 1", [$user]);
if (isset($us['ID'])) {
return tabs($us[$data]);
}else{
return 0;
}
}
}
/*
-------------------
IP + SESSION + HASH
-------------------
*/
if (config('AUT_MODE') == 1){
$user = 0;
if (session('HASH') && db::get_column("SELECT COUNT(*) FROM `USERS` WHERE `IP` = ? AND `HASH` = ? LIMIT 1", [IP, esc(session('HASH'))]) == 1) {
$user = esc(session('HASH'));
}
function user($data){
global $user;
$us = db::get_string("SELECT * FROM `USERS` WHERE `HASH` = ? LIMIT 1", [$user]);
if (isset($us['ID'])) {
return tabs($us[$data]);
}else{
return 0;
}
}
}
/*
-----------------------------
IP + BROWSER + SESSION + HASH
-----------------------------
*/
if (config('AUT_MODE') == 2){
$user = 0;
if (session('HASH') && db::get_column("SELECT COUNT(*) FROM `USERS` WHERE `IP` = ? AND `BROWSER` = ? AND `HASH` = ? LIMIT 1", [IP, BROWSER, esc(session('HASH'))]) == 1) {
$user = esc(session('HASH'));
}
function user($data){
global $user;
$us = db::get_string("SELECT * FROM `USERS` WHERE `HASH` = ? LIMIT 1", [$user]);
if (isset($us['ID'])) {
return tabs($us[$data]);
}else{
return 0;
}
}
}
require_once (ROOT.'/system/connections/array_to_function.php');
require_once (ROOT.'/system/connections/timezone.php');
require_once (ROOT.'/system/connections/access.php');
/*
---------------
Доступ в панель
---------------
*/
if (user('ID') > 0 && user('MANAGEMENT') == 1){
define('MANAGEMENT', 1);
}else{
define('MANAGEMENT', 0);
}
/*
------------------------------
Количество пунктов на страницу
------------------------------
*/
if (user('ID') > 0){
define('PAGE_SETTINGS', intval(settings('STR')));
}else{
define('PAGE_SETTINGS', intval(config('STR_GUESTS')));
}
/*
------------------
Подгрузка плагинов
------------------
*/
direct::components(ROOT.'/system/connections/global/users/', 0);