*/ if (empty($ma[1])) { $ma[1][0] = $GLOBALS['DefaultController']; } elseif (!in_array($ma[1][0], $GLOBALS['Controllers'])) { array_unshift($ma[1], '404'); } $GLOBALS['CurrentController'] = $ma[1][0]; $GLOBALS['REQAR'] = $ma[1]; //$GLOBALS['__graph'] = $tpl_graph; if (!G::IsLogged()) { $GLOBALS['CurrentController'] = 'login'; $GLOBALS['REQAR'] = array(); } else { $User = new Users(); $User->SetUser($_SESSION['member']) or exit('Ошибка пользователя.1'); _acl::load($User->fields['gid']); } /** * Для удобства некоторые переменные из REQUEST_URI объявляются в массиве $_GET */ foreach ($ma[1] as $item) { if (preg_match('/^p[0-9]+/', $item, $match)) { $GLOBALS['Page_id'] = (int) preg_replace('/^p/', '', $match[0]); } if (preg_match('#^p([\\d]+)$#is', $item, $ma1)) { $_GET['page_id'] = $ma1[1]; // $GLOBALS['Page_id'] = $ma1[1]; } } unset($ma); unset($ma1);
// connection to mysql server if (phpversion() >= 5.6) { $db = new mysqlPDO($GLOBALS['DB']['HOST'], $GLOBALS['DB']['USER'], $GLOBALS['DB']['PASSWORD'], $GLOBALS['DB']['NAME']); } else { $db = new mysqlDb($GLOBALS['DB']['HOST'], $GLOBALS['DB']['USER'], $GLOBALS['DB']['PASSWORD'], $GLOBALS['DB']['NAME']); } $GLOBALS['db'] =& $db; $sql = "SELECT * FROM " . _DB_PREFIX_ . "profiles"; $profiles = $db->GetArray($sql); $admin_controllers = G::GetControllers(str_replace('~core', 'adm' . DIRSEP . 'core', $GLOBALS['PATH_contr'])); foreach ($profiles as &$profile) { define('_ACL_' . strtoupper($profile['name']) . '_', $profile['id_profile']); } G::ToGlobals(array('ACL_PERMS' => array('rights' => $admin_controllers, 'groups' => $profiles))); if (G::IsLogged()) { _acl::load($_SESSION['member']['gid']); } $unwatch = array('95.69.190.43', '178.150.144.143'); if (!in_array($_SESSION['client']['ip'], $unwatch) && strpos($_SESSION['client']['ip'], '192.168.0') !== 0) { $sql1 = "SELECT * FROM " . _DB_PREFIX_ . "ip_connections WHERE ip = '" . $_SESSION['client']['ip'] . "' AND sid = 1"; $ips = $db->GetOneRowArray($sql1); // if(!$ips){ // $sql2 = "INSERT INTO "._DB_PREFIX_."ip_connections (ip, connections, last_connection, user_agent".(G::IsLogged()?', id_user':null).") VALUES ('".$_SESSION['client']['ip']."', 1, '".date("Y-m-d H:i:s")."', '".$_SERVER['HTTP_USER_AGENT']."'".(G::IsLogged()?', '.$_SESSION['member']['id_user']:null).")"; // $ips = $db->GetOneRowArray($sql1); // }else{ // $sql2 = "UPDATE "._DB_PREFIX_."ip_connections SET connections = ".($ips['connections']+1).", last_connection = '".date("Y-m-d H:i:s")."', user_agent = '".$_SERVER['HTTP_USER_AGENT']."'".(G::IsLogged()?", id_user = "******" WHERE ip = '".$_SESSION['client']['ip']."' AND sid = 1"; // } // $db->Query($sql2); if ($ips && $ips['block'] == 1) { header('Location: ' . _base_url); exit;