<?php
$pname = 'Игра';
$pkey = 'игра';
$pdesc = 'Игра';
include('inc/top.php');
?>
<!-- Контент -->

<link href="/css/clock/css/style.css" rel="stylesheet" />
<style>
.scrolled::-webkit-scrollbar {
width: 3px;
}
.scrolled::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px transparent; 
-webkit-border-radius: 10px;
border-radius: 10px;
}
.scrolled::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: rgba(255, 161, 51, 0.82); 
-webkit-box-shadow: inset 0 0 6px #fff); 
}
.scrolled::-webkit-scrollbar-thumb:window-inactive {
background: #FFA133; 
}
.scrolled {
-moz-background-size: 100%;
-webkit-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
}
</style>

<div class="gamehall_wrapper">
				<div class="index_gamehall_wrapper">
				<div class="jackpot_block progressive">
<div class="jackpot_sum js-jackpot-progressive" style="
    padding: 220px 0 42px;
    font-size: 52px;
    font-weight: bold;
    line-height: 52px;
    text-shadow: 0 0 8px #ba1716, 0 0 12px #ba1716;
    color: #fff;
"><?php $ng = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT endgame,nowg,jack FROM t_data LIMIT 1")); echo $ng['jack']; ?>₽</div>
		<div class="jackpot_text">
			«Время до начала розыгрыша» <div id="clock" class="light" style="margin-top: -10px;">
<div class="display">
<div class="digits"></div>
</div>
</div><br>
			<a style="
    font-size: 35px;
    text-decoration: none;
">ТЕКУЩИЙ ПРИЗ: <?php echo $ng['nowg']; ?>₽</a>
					</div>
		<a data-toggle="modal" role="button" class="button yellow big" href="#go">Сделать ставку</a>
	</div>


</div>
<br /><br /><br />
<div class="js-winners-list" data-jackpot="progressive">
	<div class="jackpot_winner">
		<center><div class="title_h2">Список ставок:</div></center>
		<br>
		<table class="table">
			<thead>
			<tr>
				<th width="160px"><div class="overflow_color"><a class="js-sort ">Игрок</a></div></th>
				<th width="80px"><div class="overflow_color"><a class="js-sort">Ставка</a></div></th>
				<th width="138px"><div class="overflow_color"><a class="js-sort active_arrow" >Дата</a></div></th>
			</tr>
			</thead>
			<tbody>
		<?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)) {
?>
		<tr>
				<td><div class="overflow" style="width:140px"><?php echo $rowi['log']; ?></div></td>
				<td><div class="overflow" style="width:130px"><?php echo $rowi['sum']; ?> ₽</div></td>
				<td><div class="overflow"><?php echo date('d.m.y H:i',$rowi['dt']); ?></div></td>
			</tr>
		<?php }
} else { echo '<tr><td colspan="3"><center>Ставок нет</center></td></tr>'; } ?>

		

		
		</tbody>
		</table>
		<div style="margin-top:20px">
<center><a data-toggle="modal" role="button" href="#go" class="btn btn-theme-bg">Сделать ставку</a></center>
</div>
	</div>

	
</div>

<br /><br />
<div style="clear:both"></div>
<div id="go" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm center_modal">
<div class="modal-content">
<div class="modal-body with-padding">
<center>
<div class="sky-form sky-form-columns">
<label class="input">
<input id="sums" type="text" class="sum" required="required" placeholder="Сумма ставки" autocomplete="off" class="form-control" style="width:70%; margin: 20px 0px 20px 0px;" />
</label>
</div>
<a class="btn btn-theme-bg" href="javascript://" id="submit">Поставить</a>
</center>
</div>
</div>
</div>
</div></div>
<font id="win"></font>
<script type='text/javascript'>
var a1=<?php if ($ng['endgame'] == 0) { echo '000'.$timemin.'00'; } else { $te = $ng['endgame']-time(); if ($te <= 0) { echo '000001'; } else { echo $te; } } ?>;
$('#submit').click(function(){
var sum = $('#sums').val();
$.ajax({
type: 'POST',
url: '/actions/play.php',
data: {'sum': sum},
cache: false,
success: function(result){
if (result == '0') {
$.jGrowl('Вы не указали сумму ставки', { theme: 'growl-error' });
}
if (result == '1') {
$('#go').modal('hide');
$('#sums').val('');
$.jGrowl('Успешно', { theme: 'growl-success' }); lots_load(); lots_priz();
}
if (result == '2') {
$.jGrowl('Минимальная ставка - 1 рубль', { theme: 'growl-error' });
}
if (result == '3') {
$.jGrowl('На балансе Вашего аккаунта недостаточно средств', { theme: 'growl-error' });
}
if (result == '5') {
$.jGrowl('Вы не авторизованы', { theme: 'growl-error' });
}
if (result == '6') {
$.jGrowl('Ошибка', { theme: 'growl-error' });
}
}
});
});
$(document).ready(function () {
$('.sum').keyup(function() {
var $th = $(this);
$th.val( $th.val().replace(/[^0-9\.]/g, function(){ return ''; }) );
});
});
function lots_load(){
$.ajax({
type: 'POST',
url: '/actions/load_lots.php',
data: {'ok': 'ok'},
cache: false,
success: function(result){
if (result == '3') {
} else {
$('.scrolled').html(result);
}
}
});
};
function lots_priz(){
$.ajax({
type: 'POST',
url: '/actions/load_priz.php',
data: {'ok': 'ok'},
cache: false,
success: function(result){
if (result == '3') {
} else {
exp = result.split('|');
$('#prz').html(exp[0]);
$('#jack').html(exp[1]);
$('#ubal').html(exp[3]);
a1 = exp[2];
}
}
});
};
function load_win(){
$.ajax({
type: 'POST',
url: '/actions/load_win.php',
data: {'ok': 'ok'},
cache: false,
success: function(result){
if (result == '3') {
} else {
a1='000<?php echo $timemin; ?>00';
load_winner();
}
}
});
};
function load_winner(){
setTimeout(function() {
$.ajax({
type: 'POST',
url: '/actions/load_winner.php',
data: {'ok': 'ok'},
cache: false,
success: function(result){
if (result == '3') {
} else {
$('#win').html(result);
}
}
});
}, 5000);
};
setInterval(function() {
lots_load();
lots_priz();
}, 5000);
$(function(){
var clock = $('#clock'),
alarm = clock.find('.alarm'),
ampm = clock.find('.ampm');
var digit_to_name = 'zero one two three four five six seven eight nine'.split(' ');
var digits = {};
var positions = [
'm1', 'm2', ':', 's1', 's2'
];
var digit_holder = clock.find('.digits');
$.each(positions, function(){
if(this == ':'){
digit_holder.append('<div class="dots">');
}
else{
var pos = $('<div>');
for(var i=1; i<8; i++){
pos.append('<span class="d' + i + '">');
}
digits[this] = pos;
digit_holder.append(pos);
}
});
(function update_time(){
if (a1 < <?php echo $timemin*60; ?>) {
if(a1>=1){
var h1=(parseInt(a1/3600));
if(h1<10){h1="0"+h1};
var sl1=a1-h1*3600;
var m1=(parseInt(sl1/60));
if(m1<10){m1="0"+m1};
var ls1=sl1-m1*60;
if(ls1<10){ls1="0"+ls1;}
now = '00'+m1+ls1;
a1--;
}
else{
load_win();
}
} else { now = '000<?php echo $timemin; ?>00'; }
digits.m1.attr('class', digit_to_name[now[2]]);
digits.m2.attr('class', digit_to_name[now[3]]);
digits.s1.attr('class', digit_to_name[now[4]]);
digits.s2.attr('class', digit_to_name[now[5]]);
ampm.text(now[7]+now[8]);
setTimeout(update_time, 1000);
})();
});
</script>

<!-- /Контент -->
<?php include('inc/bottom.php'); ?>