<?php
include('conf.php');
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
session_set_cookie_params(604800000, "/", SITE, false, false);
session_start();
if(!empty($_SESSION['uid']) && !empty($_SESSION['login']) && !empty($_SESSION['pass'])) {
define('USER_LOGGED',true);
$u_id=intval($_SESSION['uid']);
$u_login=mysqli_real_escape_string($connect_db, $_SESSION['login']);
} else { define('USER_LOGGED',false); }
if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown'))
$ip=getenv('HTTP_CLIENT_IP');
elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown'))
$ip=getenv('HTTP_X_FORWARDED_FOR');
elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv("REMOTE_ADDR"), 'unknown'))
$ip=getenv('REMOTE_ADDR');
elseif(!empty($_SERVER['REMOTE_ADDR']) && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown'))
$ip=$_SERVER['REMOTE_ADDR'];
else{$ip='unknown';}
if($ip!='unknown'){
$ip=preg_replace("#[^0-9]+#i",'',$ip);
$time=time();
$past=time()-600;
$result=mysqli_query($connect_db, "SELECT last FROM t_online WHERE ip='".$ip."'");
if(mysqli_num_rows($result)!=0){ mysqli_query($connect_db, "UPDATE t_online SET last='".$time."', uid='".$u_id."' WHERE ip='".$ip."' LIMIT 1"); }
else{
mysqli_query($connect_db, "INSERT INTO t_online (uid,ip,last) VALUES ('".$u_id."','".$ip."','".$time."')"); }
if(substr($time,9,1)==0){ mysqli_query($connect_db, 'DELETE FROM t_online WHERE last<'.$past); }
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="keywords" content="<?php echo $pkey; ?>" />
<meta name="description" content="<?php echo $pdesc; ?>" />
		<meta name="viewport" content="width=device-width">
<title><?php echo $pname; ?></title>
	<link rel="shortcut icon" type="image/x-icon" href="files/pbd/ico/favicon.ico">
	<link href="index.html" rel="canonical">	
	<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet" type="text/css" media="screen">
<link href="/sky-form/css/sky-forms.css" rel="stylesheet" type="text/css" media="screen">
<link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="/css/animate.css" rel="stylesheet" type="text/css" media="screen">
<link href="/css/yamm.css" rel="stylesheet" type="text/css">
<link href="/css/magnific-popup.css" rel="stylesheet" type="text/css">
<link href="/css/st.css" rel="stylesheet" type="text/css">
<script src="/js/jquery.min.js"></script> 

<link href="files/pbd/css/build/core-pbd-9cefb6a9.min.css" rel="stylesheet"><link href="files/pbd/css/build/flexible-pbd-b84cea33.min.css" rel="stylesheet">
	</head>
<body class="theme ru">


<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="header_wrapper">

	<header>
				<div class="wrapper ">
			<div class="logo_wrapper logo_normal">
	<a href="index.html" class="logo"><img src="files/pbd/img/base/logo.png" alt=""/></a>
			<a href="index.html" class="logo_ball"><img src="files/pbd/img/base/logo_ball.png" alt=""/></a>
	</div>
<div class="logo_wrapper logo_fixed">
	<a href="index.html" class="logo"><img src="files/pbd/img/base/header_fixed/logo.png" alt=""/></a>
		<a class="logo_ball" href="index.html"><img src="files/pbd/img/base/header_fixed/logo_ball.png" alt=""/></a>
</div>
<?php
if(USER_LOGGED) {
$nb = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT bal FROM t_users WHERE uid='$u_id'")); $nbal = $nb['bal'];
} ?>
			<form class="login_wrapper" method="post" action="http://mypobeda2.com/actions/user/auth" id="js-auth-login-block">
	<div>
		<input type="text" class="input" placeholder="Имя пользователя" id="u_login"
		><input type="password" class="input" placeholder="Пароль" id="u_pass"
		><a href="javascript://" id="submit_login" class="button orange">Войти</a>
	</div>
	<div>
		<a class="login_forget" href="/lostpassword">Забыли пароль?</a> <a class="button middle orange" href="/register">Регистрация</a
		><div class="login_social">
			<a href="javascript:void(0)" onclick="VKConnect()"><img src="files/pbd/img/base/social/icon_vk.png" alt="" title="Вконтакте"></a
			><a href="javascript:void(0)" onclick="MailruConnect()"><img src="files/pbd/img/base/social/icon_mailru.png" alt="" title="Mail.ru"></a
			><a href="javascript:void(0)" onclick="OdklConnect()"><img src="files/pbd/img/base/social/icon_odkl.png" alt="" title="Одноклассники"></a>
		</div>
	</div>
</form>
<?php if(!USER_LOGGED) { ?>
<?php } else { ?>
<div class="auth_wrapper">
		<div class="auth_login_wrapper overflow">
			<a class="auth_login" href="/profile"><?php echo $u_login.''; ?></a><br>
							<a class="auth_profile" href="/profile">Личный кабинет</a>
			
		</div>
		<div class="auth_account">
			<a href="/cash">
				На счете:<br>
				<span class="js-placeholder" data-name="account">
					<?php echo ''.$nbal.''; ?>&nbsp;₽				</span>
			</a>
		</div><a class="button middle orange" href="/cash">Пополнить/Вывести</a>
	</div>
<?php } ?>

		</div>
		
	</header>
	<nav>
		<div class="wrapper">
			<ul>
			<li class="">
			<a href="/" class="">
				Главная			</a>
		</li>
			<li class="">
			<a href="/games" class="">
				История побед		</a>
		</li>
			<li class="">
			<a href="/offer" class="">
				Правила		</a>
		</li>
			<li class="">
			<a href="/contacts" class="">
				Контакты			</a>
		</li>
	</ul>
		</div>
	</nav>
</div>

<div class="content_wrapper">
	<div class="wrapper">
		<div class="notice notice_content js-notice-placeholder" style="display: none;"></div>		
		<div class="index_wrapper">
<div class="index_top_block">
		<div class="index_wrapper_slider" id="sliderContainer">
				<div class="index_item_slider js-slide" data-slide="0" style="display: none;">
		<span class="b_span"><div class="b_main_top b_main_bonus_welcome">
	<div class="b_main_bonus_welcome_content">
		<p class="b_main_bonus_welcome_top">Зарегистрируйтесь и получите</p>
		<p class="b_main_bonus_welcome_bottom">Приветственный бонус до</p>
		<a class="button big gold gold_glow" href="/cashier?tracker=banner_b_main_bonus_welcome_follow">Получить бонус</a>
	</div>
</div></span>	</div>
	<div class="index_item_slider js-slide" data-slide="1" style="display: none;">
		<span class="b_span"><div class="b_main_top b_main_payout">
	<div class="b_main_payout_content">
		<p class="b_main_payout_top">Выплата Вашего выигрыша</p>
		<p class="b_main_payout_middle">в течение двух дней!</p>
		<p class="b_main_payout_bottom">Гарантируем!</p>
		<a class="button big gold gold_glow" href="/gamehall?tracker=banner_b_main_payout_follow">Играть сейчас!</a>
	</div>
</div></span>	</div>
	<div class="index_item_slider js-slide" data-slide="2" style="display: block;">
		<span class="b_span"><div class="b_main_top b_main_bet">
	<div class="b_main_bet_content">
		<p class="b_main_bet_top">Сделай ставку</p>
		<p class="b_main_bet_middle">на Победу!</p>
		<p class="b_main_bet_bottom">И стань победителем!</p>
		<a class="button big gold gold_glow" href="/register">Играть сейчас!</a>
	</div>
</div></span>	</div>
<div class="index_button_block">
			<div class="index_button_slide js-slide-button active" data-slide="0"></div>
			<div class="index_button_slide js-slide-button" data-slide="1"></div>
			<div class="index_button_slide js-slide-button" data-slide="2"></div>
	</div>

		</div>
	</div>
		<div class="sidebar_wrapper right">
		<div class="content">
			<div class="title_h2"><?php echo $pname; ?></div>
			<a class="gamehall_index_more" href="/register"><span>Регистрация</span> <img
					src="files/pbd/img/base/bg_pag_next.png" alt=""/></a>
			<div class="gamehall_wrapper">
				<div class="index_gamehall_wrapper">
	<div id="mycarousel" class="jcarousel-skin-tango">
		<ul></ul>
	</div>
	<div class="pagination_arrow">
		<div class="jcarousel-scroll"></div>
	</div>
</div>


<script type="text/html" id="menu_tpl">
	<div class="jcarousel-scroll pagination_wrapper pagination_wrapper_numeric">
		<a class="prev_pag %(prevPageClass)" href="%(prevUrl)" class="">Назад</a>
		<div class="jcarousel-control pagination_page_number" id="holder">
			%(menu_items)
		</div>
		<a class="next_pag %(nextPageClass)" href="%(nextUrl)">Вперед</a>
	</div>
</script><script src="files/default/js/build/main_slider-2bfcaf36.min.js"></script>
<script src="files/v3/js/build/v3-gamehall-10f774d8.min.js"></script>
			</div>
		</div
		><div class="sidebar">
			<div id="js_volcano_pulse_block" class="index_winners_wrapper">

	<div class="index_winners_title">
		<div class="title_h4">Последние ставки</div>
	</div>

	<div class="index_item_content" id="index_item_slots_content">
		<div class="index_winners_carousel_wrapper" id="index_winners_slots1">
			<ul class="index_winners_carousel">
											<?php
$qin = mysqli_query($connect_db, "SELECT id,usr,sum,t_play.dt,log FROM t_play INNER JOIN t_users ON t_play.usr = t_users.uid ORDER BY id DESC");
$qinn = mysqli_num_rows($qin);
if ($qinn > 0) {
while($rowi = mysqli_fetch_array($qin)) {
?>
<li>
						<div class="winner_info">
							<div class="color_overflow">
								<?php echo $rowi['log']; ?>							</div>
							<span><?php echo $rowi['sum']; ?> &#8381;</span>
						</div>
						<a id="haunter" class="winners_slot"></a>
					</li>
		<?php }
} else { echo '<tr><td colspan="3"><center>Ставок нет</center></td></tr>'; } ?>

											</ul>
		</div>
	</div>
	<div class="index_winners_button">
		<a href="gamehall.html" class="button middle gold">Играть сейчас!</a>
	</div>
</div>							<div class="high_low_wrapper">

	<div id="game_high_low">
</div>
</div>

					</div>							<div class="high_low_wrapper">
	<div id="game_high_low"></div>
</div>