<?php
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set('display_errors', false);
@ini_set('html_errors', false);
@ini_set('error_reporting', E_ALL ^ E_NOTICE);
date_default_timezone_set('Europe/Moscow');
$track_num = -1;
$window = $_POST['window'];
$ajax = $_POST['ajax'];
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {$ajax_query = true;}
session_start();
session_name('sid');
foreach ($_GET as $check_url) {
if (!is_string($check_url)) {
header ('Location: ../');
exit;
}
}
$mysqli = new mysqli('localhost', 'root', 'pass', 'name');
$mysqli->query("SET NAMES 'utf8mb4'");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
define('URL', 'http://'.$_SERVER['HTTP_HOST']);
define('HOME', $_SERVER['DOCUMENT_ROOT']);
# Для юзера
session_start();
if(isset($_COOKIE['mail']) && isset($_COOKIE['pass'])) {
$mail = $_COOKIE['mail'];
$pass = md5(md5($_COOKIE['pass']));
}
$sys = $mysqli->query("SELECT `id` FROM `user` WHERE `mail` = '".$mail."' AND `pass` = '".$pass."'")->fetch_array();
$user_id = $sys['id'];
$user = $mysqli->query("SELECT * FROM `user` WHERE `id` = '".$user_id."'")->fetch_array();
#код для онллайна
if ($mysqli->query("SELECT `id` FROM `user` WHERE `time_on` < '".(time() - 600)."' AND `online` = '1' LIMIT 1")->num_rows == true) $mysqli->query("UPDATE `user` SET online = '0' WHERE `time_on` < '".(time() - 600)."' AND online = '1'");
$mysqli->query("UPDATE `user` SET `online` = '1', `time_on` = '".(time() + 600)."' WHERE `id` = '".$user_id."' LIMIT 1");
?>