Файл: incfiles/core.php
Строк: 77
<?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/Kiew');
$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) || !preg_match("#^([A-zА-я-0-9ІіЇїЄє.])+$#ui", str_replace("'", "", $check_url))) {
header ('Location: ../');
exit;
}
}
define ('DBHOST', 'localhost');
define ('DBNAME', 'test1');
define ('DBPASS', '');
define ('DBUSER', 'root');
$db = mysql_connect(DBHOST, DBUSER, DBPASS) or die(mysql_error('Ошибка подключения, к пользователю БД MySQL, либо не верно введен пароль! Проверьте параметры подключения!'));
mysql_query('SET NAMES `utf8`', $db);
mysql_select_db(DBNAME, $db) or die('Ошибка подключения к БД MySQL! Проверьте параметры подключения!');
// подключаемся к базе данных mysqli
$dbi = mysqli_connect("localhost", "root", "", "test1");
if (!$dbi) {
print ("Не удалось соединиться с базой данных.<br />n");
exit();
}
mysqli_query($dbi,'set charset utf8');
mysqli_query($dbi,'SET names utf8');
mysqli_query($dbi,'set character_set_client="utf8"');
mysqli_query($dbi,'set character_set_connection="utf8"');
mysqli_query($dbi,'set character_set_result="utf8"');
require_once('pdo.php');
$system = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `settings` WHERE `id` = '1' LIMIT 1"));
define('URL', 'http://'. $system['url']);
define('HOME', $_SERVER['DOCUMENT_ROOT']);
function go($link) {
header('location: '.$link); exit;
}
function check($str) {
$str = htmlentities(trim($str), ENT_QUOTES, 'UTF-8');
$str = nl2br($str);
$str = strtr($str, array (
chr(0)=> '',
chr(1)=> '',
chr(2)=> '',
chr(3)=> '',
chr(4)=> '',
chr(5)=> '',
chr(6)=> '',
chr(7)=> '',
chr(8)=> '',
chr(9)=> '',
chr(10)=> '',
chr(11)=> '',
chr(12)=> '',
chr(13)=> '',
chr(14)=> '',
chr(15)=> '',
chr(16)=> '',
chr(17)=> '',
chr(18)=> '',
chr(19)=> '',
chr(20)=> '',
chr(21)=> '',
chr(22)=> '',
chr(23)=> '',
chr(24)=> '',
chr(25)=> '',
chr(26)=> '',
chr(27)=> '',
chr(28)=> '',
chr(29)=> '',
chr(30)=> '',
chr(31)=> ''
));
$str = str_replace("'", "'", $str);
$str = str_replace('\', "\", $str);
$str = str_replace("|", "I", $str);
$str = str_replace("||", "I", $str);
$str = str_replace("/\$/", "$", $str);
$str = str_replace("<br /><br /><br />", "<br />", $str);
$str = mysql_real_escape_string($str);
return $str;
}
function links($text) {
$text = preg_replace("/(^|[n ])([w]*?)((ht|f)tp(s)?://[w]+[^ ,"nrt<]*)/is", "$1$2<a href="$3" target="blank">$3</a>", str_replace("<br />", "n", $text));
return str_replace("n", "<br />", $text);
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && filter_var($_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['REMOTE_ADDR'];
else die('Unknown');
$ua = check($_SERVER['HTTP_USER_AGENT']);
function check_mobile() {
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$mobile_agent_array = array('ipad', 'iphone', 'android', 'pocket', 'palm', 'windows ce', 'windowsce', 'cellphone', 'opera mobi', 'ipod', 'small', 'sharp', 'sonyericsson', 'symbian', 'opera mini', 'nokia', 'htc_', 'samsung', 'motorola', 'smartphone', 'blackberry', 'playstation portable', 'tablet browser');
// var_dump($agent);exit;
foreach ($mobile_agent_array as $value) {
if (strpos($ua, $value) !== false) return true;
}
return false;
}
$is_mobile_device = check_mobile();
if($is_mobile_device) $device = 'Mobile'; else $device = 'Computer';
?>