Файл: core/start.php
Строк: 82
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
session_start();
ob_start();
require_once('config.php');
require_once('count.php');
require_once('class/nav.php');
require_once('class/browser.php');
require_once('functions.php');
gen_timer_start();
/* Cookie orqali kirish */
if (empty($_SESSION['user_id'])) {
if (!empty($_COOKIE['nick']) && !empty($_COOKIE['password'])) {
$nick = html($_COOKIE['nick']);
$password = html($_COOKIE['password']);
$sql = DB::$dbs->queryFetch("SELECT `user_id` FROM ".USERS." WHERE `nick` = ? && `password` = ?",array($nick, $password));
if ($sql) {
$_SESSION['user_id'] = $sql['user_id'];
header("Location: ".HOME."/");
}
}
}
if (isset($_GET['select'])) {
$select = html($_GET['select']);
} else {
$select = NULL;
}
/* Ro`yhatdan o`tgan foydalanuvchiga */
if (isset($_SESSION['user_id'])) {
/* Brauzer/IP ni bilib olish*/
$browser = new Browser();
$user_agent = $browser->getBrowser() . ' (Versiya: ' . $browser->getVersion() . ')';
$ip = getIP2();
DB::$dbs->query("UPDATE ".USERS." SET `browser` = ?, `ip` = ?, `last_time` = ? WHERE `user_id` = ?",array($user_agent, $ip, time(), num($_SESSION['user_id'])));
/**/
$user = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array(num($_SESSION['user_id'])));
if (!file_exists(inc . 'style/themes/' . $user['style'] . '/head.php')) {
$styler = 'default';
} else {
$styler = $user['style'];
}
if (empty($user)) {
unset($_SESSION['user_id']);
header("Location: ".HOME."/index.php");
}
/* Banga tekshirish */
$bann = DB::$dbs->queryFetch("SELECT * FROM ".BANN." WHERE `user_id` = ? && `time_bann` > ?", array($user['user_id'], time()));
if ($bann == TRUE) {
head('Siz bloklangansiz!');
echo DIV_BLOCK . 'Siz bloklangansiz!<br /><b>Sababi:</b> ' . $bann['prich'] . '<br /><b>Ban tugash vaqti:</b> ' . vrem($bann['time_bann']) . CLOSE_DIV;
require_once('core/stop.php');
exit();
}
/* Qora ro`yhatga tekshirish */
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".BLACKLIST." WHERE `ua` = ? && `ip` = ? ", array($user_agent, $ip)) == TRUE) {
head('Siz bloklangansiz!');
echo DIV_ERROR . 'Sizning User Agent va IP qora ro`hatda. Saytga kirish taqiqlanadi.' . CLOSE_DIV;
require_once('core/stop.php');
exit();
}
/* Kunlik bonus */
if (!empty($user) && $user['bonus_time'] < time()) {
$balls = rand(1,50);
head('Kunlik bonus');
echo DIV_BLOCK . 'Salom! Saytimiz ma`muriyati sizni bugun saytga tashrif qilganizdan hursand!<br />Shu sababli, bizdan sizga ' . $balls . ' ball sovg`a!
Har kuni kiring va ko`proq ballga ega bo`ling! :)<br /><br /><a href="'.HOME.'"><b>Saytga kirish</b></a>' . CLOSE_DIV;
DB::$dbs->query("UPDATE ".USERS." SET `bonus_time` = ?, `balls` = ? WHERE `user_id` = ?",array((time() + 86400), ($user['balls'] + $balls), num($_SESSION['user_id'])));
$array = array();
nav($array);
require_once('core/stop.php');
exit();
/**/
}
}else{
if (!file_exists(inc . 'style/themes/' . $user['style'] . '/head.php')) {
$styler = 'default';
} else {
$styler = $user['style'];
}
}
if ($user)mobile_detect();
?>