Файл: games/xo/index.php
Строк: 357
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title'] = 'Крестики - Нолики'; // заголовок страницы
include_once '../../sys/inc/thead.php';
echo '<link rel="stylesheet" href="style/css.css" type="text/css"/>'; // Стиль в игре
title();
aut();
$game = mysql_fetch_assoc(mysql_query("SELECT * FROM `kr_nol_3x3` WHERE `id_user` = '$user[id]' OR `id_prot` = '$user[id]'"));
$avtor = get_user($game['id_user']);
$prot = get_user($game['id_prot']);
$game_my = mysql_result(mysql_query("SELECT COUNT(*) FROM `kr_nol_3x3` WHERE `id_user` = '$user[id]' OR `id_prot` = '$user[id]'"),0);
if ($avtor['id']==$user['id'])
$ank2 = get_user($prot['id']);
elseif ($prot['id']==$user['id'])
$ank2 = get_user($avtor['id']);
if (isset($_GET['us']))
{
$ank=get_user(intval($_GET['us']));
$game_ank = mysql_result(mysql_query("SELECT COUNT(*) FROM `kr_nol_3x3` WHERE `id_user` = '$ank[id]' OR `id_prot` = '$ank[id]'"),0);
}
if (isset($_GET['plus']) && $game['read']!=2 && $game['read']!=1 && $avtor['id']==$user['id'])
{
if ($avtor['money']>=$game['stav'])
{
if ($prot['money']>=$game['stav'])
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '5', `game_over` = '0', `1` = 'z', `2` = 'z', `3` = 'z', `4` = 'z', `5` = 'z', `6` = 'z', `7` = 'z', `8` = 'z', `9` = 'z', `hod` = '$ank2[id]', `u1` = '0', `u2` = '0', `u3` = '0', `u4` = '0', `u5` = '0', `u6` = '0', `u7` = '0', `u8` = '0', `u9` = '0' WHERE `id` = '$game[id]' LIMIT 1");
header("Location: ?");
exit;
}else{
msg('У противника не достаточно средств');
}
}else{
msg('У вас не достаточно средств');
}
}
if (isset($_GET['plus']) && $_GET['plus']=='ok' && $game['read']==5 && $prot['id']==$user['id'])
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '2', `time` = '$time' WHERE `id` = '$game[id]' LIMIT 1");
header("Location: ?");
exit;
}
elseif (isset($_GET['plus']) && $_GET['plus']=='no' && $game['read']==5 && $prot['id']==$user['id'])
{
mysql_query("DELETE FROM `kr_nol_3x3_komm` WHERE `id_game` = '".$game['id']."'");
mysql_query("DELETE FROM `kr_nol_3x3` WHERE `id` = '".$game['id']."'");
header("Location: ?");
exit;
}
if (isset($_GET['exit']))
{
if ($_GET['exit']=='es' && $game['read']!=2)
{
mysql_query("DELETE FROM `kr_nol_3x3_komm` WHERE `id_game` = '".$game['id']."'");
mysql_query("DELETE FROM `kr_nol_3x3` WHERE `id` = '".$game['id']."'");
header("Location: ?");
}else{
msg('Сначала завершите игру');
}
}
if (isset($_GET['null']) && $_GET['null']=='es' && $game['read']==3 && $avtor['id']==$user['id'])
{
mysql_query("UPDATE `kr_nol_3x3` SET `stav` = '0' WHERE `id` = '$game[id]' LIMIT 1");
msg('Ставка обнулена');
}
if (isset($_GET['game']) && $game['read']==1 && $prot['id']==$user['id'])
{
if (isset($_GET['game']) && $_GET['game']=='es')
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '2', `time` = '$time' WHERE `id` = '$game[id]' LIMIT 1");
header("Location: ?");
exit;
}
else if (isset($_GET['game']) && $_GET['game']=='no')
{
mysql_query("DELETE FROM `kr_nol_3x3_komm` WHERE `id_game` = '".$game['id']."'");
mysql_query("DELETE FROM `kr_nol_3x3` WHERE `id` = '".$game['id']."'");
// отправка уведомления
$msg = 'К сожалению, пользователь [b]'.$user['nick'].'[/b] отказался играть с вами в [b]"[url=/plugins/games/xo/index.php]Крестики - Нолики[/url]"[/b]';
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank2[id]', '".my_esc($msg)."', '$time')");
header("Location: index.php?");
exit;
}
}
if (isset($_GET['us']))
{
if ($user['id']!=$_GET['us'] && $game_my==0)
{
if ((isset($_POST['stav'])) && ($_POST['stav']==0 || $_POST['stav']==100 || $_POST['stav']==200 || $_POST['stav']==300))
{
if ($user['money']>=$_POST['stav'])
{
if ($ank['money']>=$_POST['stav'])
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==1)
{
if ($game_ank==0)
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' AND `date_last` > '".(time()-600)."' LIMIT 1"),0)==1)
{
mysql_query("INSERT INTO `kr_nol_3x3` (`stav`, `read`, `hod`, `id_user`, `id_prot`, `time`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`)
values('".intval($_POST['stav'])."', '1', '".intval($_GET['us'])."', '$user[id]', '".intval($_GET['us'])."', '$time', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z')");
// отправка приглашения
$msg = 'Пользователь [blue]'.$user['nick'].'[/blue] приглашает вас сыграть в [url=/games/xo/index.php][green]Крестики - Нолики[/green][/url]';
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('2', '$ank[id]', '".my_esc($msg)."', '$time')");
header("Location: ?uved=ok");
exit;
}else{
msg('Пользователь не в сети');
}
}else{
msg('Пользователь уже учавствует в игре');
}
}else{
msg('Такого пользователя не сущечтвует');
}
}else{
msg('У противника не достаточно средств');
}
}else{
msg('У вас не достаточно средств');
}
}
}
echo '<table class="mess">';
echo "<td width='3%'>".avatar($ank['id'])."</td><td> ".group($ank['id'])." ".user::nick($ank['id'])." ".medal($ank['id'])." ".online($ank['id'])."</td>";
echo '</table>';
echo "<form method="post" name="message" action="?us=$ank[id]">n";
echo '<div class="mess">';
echo "Ставка монет: <select name='stav'>n";
echo "<option value='300' selected='selected'>300 </option>n";
echo "<option value='200' selected='selected'>200 </option>n";
echo "<option value='100' selected='selected'>100 </option>n";
echo "<option value='0' selected='selected'>Нет</option>n";
echo "</select><br />n";
echo "<input value="Отправить приглашение" type="submit" />n";
echo "</form>n";
echo "</div>";
include_once '../../sys/inc/tfoot.php';
exit;
}
$q = mysql_query("SELECT * FROM `kr_nol_3x3` WHERE `id` = '$game[id]' limit 1");
$o = '<img src="0.jpg" alt="*"/>';
$x = '<img src="x.jpg" alt="*"/>';
$z = '<img src="z.jpg" alt="*"/>';
if ($avtor['id']==$user['id'])
$n = 'x';
else
$n = 'o';
$p = $game['stav'];
$sec2 = -90-$game['time']+$time;
if ($sec2>0 && $game['read']==2)
{
if ($avtor['id']==$game['hod'])
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$prot[id]' WHERE `id` = '$game[id]' LIMIT 1");
$game['game_over']=$prot['id'];
}
elseif ($prot['id']==$game['hod'])
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$avtor[id]' WHERE `id` = '$game[id]' LIMIT 1");
$game['game_over']=$avtor['id'];
}
if ($game['stav']>0)
{
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
}
header("Location: ?");
exit;
}
if (isset($_GET['hod']) && $game['hod']==$user['id'] && $game['u'.intval($_GET['hod']).'']==0 && $game['game_over']==0 && $game['read']==2 && $sec2<0)
{
mysql_query("UPDATE `kr_nol_3x3` SET `time` = '$time', `".intval($_GET['hod'])."` = '$n', `u".intval($_GET['hod'])."` = '$user[id]', `hod` = '$ank2[id]' WHERE `id` = '$game[id]' LIMIT 1");
header("Location: ?");
exit;
}
if ($game['read']==2)
{
/*-------------------горизонталь---------------------------*/
if (($game['1']=='x' && $game['2']=='x' && $game['3']=='x') || ($game['1']=='o' && $game['2']=='o' && $game['3']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u1]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u1'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
elseif (($game['4']=='x' && $game['5']=='x' && $game['6']=='x') || ($game['4']=='o' && $game['5']=='o' && $game['6']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u4]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u4'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
elseif (($game['7']=='x' && $game['8']=='x' && $game['9']=='x') || ($game['7']=='o' && $game['8']=='o' && $game['9']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u7]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u7'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
/*--------------------вертикаль----------------------------*/
if (($game['1']=='x' && $game['4']=='x' && $game['7']=='x') || ($game['1']=='o' && $game['4']=='o' && $game['7']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u1]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u1'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
elseif (($game['2']=='x' && $game['5']=='x' && $game['8']=='x') || ($game['2']=='o' && $game['5']=='o' && $game['8']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u2]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u2'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
elseif (($game['3']=='x' && $game['6']=='x' && $game['9']=='x') || ($game['3']=='o' && $game['6']=='o' && $game['9']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u3]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u3'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
}
/*-------------------------угол----------------------------*/
if (($game['1']=='x' && $game['5']=='x' && $game['9']=='x') || ($game['1']=='o' && $game['5']=='o' && $game['9']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u1]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u1'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
echo "ok $p - $game[game_over]";
}
header("Location: ?");
exit;
}
elseif (($game['7']=='x' && $game['5']=='x' && $game['3']=='x') || ($game['7']=='o' && $game['5']=='o' && $game['3']=='o'))
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '3', `game_over` = '$game[u7]' WHERE `id` = '$game[id]' LIMIT 1");
if ($game['stav']>0)
{
$game['game_over']=$game['u7'];
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']+$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']+$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
if ($game['game_over']==$prot['id'])
mysql_query("UPDATE `user` SET `money` = '".($avtor['money']-$p)."' WHERE `id` = '$avtor[id]' LIMIT 1");
elseif ($game['game_over']==$avtor['id'])
mysql_query("UPDATE `user` SET `money` = '".($prot['money']-$p)."' WHERE `id` = '$prot[id]' LIMIT 1");
}
header("Location: ?");
exit;
}
if ($game['1']!='z' && $game['2']!='z' && $game['3']!='z' && $game['4']!='z' && $game['5']!='z' && $game['6']!='z' && $game['7']!='z' &&
$game['8']!='z' && $game['9']!='z' && $game['game_over']==0)
{
mysql_query("UPDATE `kr_nol_3x3` SET `read` = '4' WHERE `id` = '$game[id]' LIMIT 1");
header("Location: ?");
}
}
if (isset($game['id']) && $game['read']==1)
{
if ($avtor['id']==$user['id'])
{
if (isset($_GET['uved']) && $_GET['uved']=='ok')
msg('Ваше приглашение отправлено');
echo '<table class="mess">';
echo "<td width='3%'>".avatar($ank2['id'])."</td><td> ".group($ank2['id'])." ".user::nick($ank2['id'])." ".medal($ank2['id'])." ".online($ank2['id'])."<br />";
echo "Ставка: ";
if ($game['stav']>0)echo " <i class='fas fa-coins'></i> $game[stav] монет";
else echo "Не используется";
echo '</td></table>';
echo "<a class='link' href='?$passgen'><i class='fas fa-angle-left'></i> Обновить</a>";
echo "<div class='gmenu'>";
echo "Ожидание второго игрока...";
echo "</div>";
echo '<a class="link" href="?exit=es"><i class="fas fa-times-circle"></i> Закончить игру</a>';
include_once '../../sys/inc/tfoot.php';
exit;
}else{
echo '<table class="mess">';
echo '<td width="3%">' .avatar($ank2['id'])."</td><td> ".group($ank2['id'])." ".user::nick($ank2['id'])." ".medal($ank2['id'])." ".online($ank2['id'])."<br />";
echo "Ставка: ";
if ($game['stav']>0)echo " <i class='fas fa-coins'></i> $game[stav] монет";
else echo "Не используется";
echo '</td></table>';
if ($game_my>0)
{
if ($game['read']==1)
{
if ($game['id_prot']==$user['id'])
echo '<table style="text-align:center;" class="mess">';
echo "<td><a style='display: block; background: #34bfad; padding: 6px; color: white; border-radius: 3px;' href='?game=es'>Принять игру</a></td>
<td><a style='display: block; background: #e68c85; padding: 6px; color: white; border-radius: 3px;' href='?game=no'>Отказаться</a></td>";
echo '</table>';
}
}
include_once '../../sys/inc/tfoot.php';
exit;
}
}
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
$mat=antimat($msg);
if ($mat)$err[]='В тексте сообщения обнаружен мат: '.$mat;
if (strlen2($msg)>512){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<1){$err='Короткое сообщение';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `kr_nol_3x3_komm` WHERE `id_game` = '$game[id]' AND `id_user` = '$user[id]' AND `msg` = '".my_esc($msg)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
elseif(!isset($err)){
mysql_query("INSERT INTO `kr_nol_3x3_komm` (`id_user`, `time`, `msg`, `id_game`) values('$user[id]', '$time', '".my_esc($msg)."', '$game[id]')");
mysql_query("UPDATE `user` SET `money` = '".($user['money']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
msg('Ваш комментарий успешно принят');
}
}
if (isset($game['id']) && $game['read']>0)
{
echo '<table class="mess">';
echo '<td width="3%">' .avatar($ank2['id'])."</td><td> ".group($ank2['id'])." ".user::nick($ank2['id'])." ".medal($ank2['id'])." ".online($ank2['id'])."<br />";
echo "Ставка: ";
if ($game['stav']>0)echo " <i class='fas fa-coins'></i> $game[stav] монет<br />";
else echo "Не используется<br />";
echo '</td></table>';
if ($game['hod']==$user['id'] && $game['read']==2)
echo "<div style='background: #ecffed;' class='mess'>Ваш ход <span style='float:right;'><i class='far fa-clock'></i> $sec2</span></div>";
else if ($game['read']==2)
echo "<div style='background: #ffecec;' class='mess'>Ход противника <span style='float:right;'><i class='far fa-clock'></i> $sec2</div>";
echo "<div class='mess'>Вы играете ";
if ($n=='o')
echo "$o<br />";
else
echo "$x<br />";
echo '</div>';
if ($game['game_over']!=0)
{
if ($game['game_over']==$user['id'])
{
echo '<div class="msg">';
echo "Вы победили! Поздравляем!<br />";
if ($game['stav']>0)echo "Вам начислено $game[stav] монет";
echo '</div>';
}
else
{
echo '<div class="err">';
echo "Вы проиграли!<br />";
if ($game['stav']>0)echo "C вас списано $game[stav] монет";
echo '</div>';
}
}
if ($game['1']!='z' && $game['2']!='z' && $game['3']!='z' && $game['4']!='z' && $game['5']!='z' && $game['6']!='z' && $game['7']!='z' &&
$game['8']!='z' && $game['9']!='z' && $game['game_over']==0 && $game['read']==4)
{
echo "<div class='msg'>";
echo "Ничья! Победила дружба!";
echo "</div>";
}
echo "<a class='link' href='?$passgen'><i class='fas fa-angle-left'></i> Обновить поле</a>";
echo '<div class="bod">';
echo '<div class="blok">';
if ($game['hod']==$user['id'] && $game['game_over']==0 && $game['read']==2)
{
while ($kr = mysql_fetch_assoc($q))
{
if ($kr['1']=='z')
echo "<a href='?hod=1'>$z</a> ";
else if ($kr['1']=='o')
echo "<a href='?hod=1'>$o</a> ";
else if ($kr['1']=='x')
echo "<a href='?hod=1'>$x</a> ";
if ($kr['2']=='z')
echo "<a href='?hod=2'>$z</a> ";
else if ($kr['2']=='o')
echo "<a href='?hod=2'>$o</a> ";
else if ($kr['2']=='x')
echo "<a href='?hod=2'>$x</a> ";
if ($kr['3']=='z')
echo "<a href='?hod=3'>$z</a> ";
else if ($kr['3']=='o')
echo "<a href='?hod=3'>$o</a> ";
else if ($kr['3']=='x')
echo "<a href='?hod=3'>$x</a> ";
if ($kr['4']=='z')
echo "<a href='?hod=4'>$z</a> ";
else if ($kr['4']=='o')
echo "<a href='?hod=4'>$o</a> ";
else if ($kr['4']=='x')
echo "<a href='?hod=4'>$x</a> ";
if ($kr['5']=='z')
echo "<a href='?hod=5'>$z</a> ";
else if ($kr['5']=='o')
echo "<a href='?hod=5'>$o</a> ";
else if ($kr['5']=='x')
echo "<a href='?hod=5'>$x</a> ";
if ($kr['6']=='z')
echo "<a href='?hod=6'>$z</a> ";
else if ($kr['6']=='o')
echo "<a href='?hod=6'>$o</a> ";
else if ($kr['6']=='x')
echo "<a href='?hod=6'>$x</a> ";
if ($kr['7']=='z')
echo "<a href='?hod=7'>$z</a> ";
else if ($kr['7']=='o')
echo "<a href='?hod=7'>$o</a> ";
else if ($kr['7']=='x')
echo "<a href='?hod=7'>$x</a> ";
if ($kr['8']=='z')
echo "<a href='?hod=8'>$z</a> ";
else if ($kr['8']=='o')
echo "<a href='?hod=8'>$o</a> ";
else if ($kr['8']=='x')
echo "<a href='?hod=8'>$x</a> ";
if ($kr['9']=='z')
echo "<a href='?hod=9'>$z</a> ";
else if ($kr['9']=='o')
echo "<a href='?hod=9'>$o</a> ";
else if ($kr['9']=='x')
echo "<a href='?hod=9'>$x</a> ";
}
}else{
while ($kr = mysql_fetch_assoc($q))
{
if ($kr['1']=='z')
echo "$z ";
else if ($kr['1']=='o')
echo "$o ";
else if ($kr['1']=='x')
echo "$x ";
if ($kr['2']=='z')
echo "$z ";
else if ($kr['2']=='o')
echo "$o ";
else if ($kr['2']=='x')
echo "$x ";
if ($kr['3']=='z')
echo "$z ";
else if ($kr['3']=='o')
echo "$o ";
else if ($kr['3']=='x')
echo "$x ";
if ($kr['4']=='z')
echo "$z ";
else if ($kr['4']=='o')
echo "$o ";
else if ($kr['4']=='x')
echo "$x ";
if ($kr['5']=='z')
echo "$z ";
else if ($kr['5']=='o')
echo "$o ";
else if ($kr['5']=='x')
echo "$x ";
if ($kr['6']=='z')
echo "$z ";
else if ($kr['6']=='o')
echo "$o ";
else if ($kr['6']=='x')
echo "$x ";
if ($kr['7']=='z')
echo "$z ";
else if ($kr['7']=='o')
echo "$o ";
else if ($kr['7']=='x')
echo "$x ";
if ($kr['8']=='z')
echo "$z ";
else if ($kr['8']=='o')
echo "$o ";
else if ($kr['8']=='x')
echo "$x ";
if ($kr['9']=='z')
echo "$z ";
else if ($kr['9']=='o')
echo "$o ";
else if ($kr['9']=='x')
echo "$x ";
}
}
echo "</div>";
echo '</div>';
if ($game['read']==5 && $prot['id']==$user['id'])
{
echo "<div class='mess'>";
echo "Ставка: ";
if ($game['stav']>0)echo "$game[stav] монет!<br />";
else echo "Не используется!<br />";
echo "Вам предложение продолжить игру...<br /><a href='?plus=ok'>[<img src='/style/icons/ok.gif'> Да играть]</a> <a href='?plus=no' >[<img src='/style/icons/delete.gif'> Закончить]</a><br />";echo "</div>";
}
else if ($game['read']==5 && $avtor['id']==$user['id'])
{
echo "<div class='mess'>";
echo "Ожидайте подтверждения второго игрока...";
echo "</div>";
}
if (isset($_GET['plus']) && $game['read']==3)
{
echo '<a class="link" href="?null=es"><i class="fas fa-coins"></i> Обнулить ставку</a>';
}
if (($game['read']==3 || $game['read']==4) && ($avtor['id']==$user['id']))
{
echo "<div class='gmenu'>";
echo "Вы можете продолжить игру... ";
echo "</div>";
echo '<a class="link" href="?plus"><i class="fas fa-dice"></i> Играть еще</a>';
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `kr_nol_3x3_komm` WHERE `id_game` = '$game[id]'"),0);
$q=mysql_query("SELECT * FROM `kr_nol_3x3_komm` WHERE `id_game` = '$game[id]' ORDER BY `id` DESC LIMIT 5");
echo '<div class="main">';
echo "<form method="post" name='message' action="?">n";
echo "<textarea placeholder='Введите сообщение...' name="msg"></textarea><br />n";
echo "<input value="Отправить" type="submit"/>n";
echo "</form>n";
echo '</div>';
if ($k_post==0)
{
echo " <div class='gmenu' style='text-align:left;'>n";
echo "Нет комментариевn";
echo " </div>n";
}
$nnn=0;
while ($post = mysql_fetch_assoc($q))
{
//$ank_c=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$ank_c=get_user($post['id_user']);
echo '<table class="mess">';
echo '<td width="3%">' . avatar($ank_c['id']) . '</td>';
echo '<td>' . group($ank_c['id'], 0) . '';
echo " ".user::nick($ank_c['id'])."";
echo '' . online($ank_c['id']) . '';
echo "<span style='float: right; font-size: .7em;'>".vremja($post['time'])."</span></br>";
echo output_text($post['msg'])."";
echo '</td></table>';
}
echo '<a class="link" href="?exit=es"><i class="fas fa-times-circle"></i> Закончить игру</a>';
}else{
if ($game_my==0)
{
echo " <div class='mess'>n";
echo "<img width='150' src='style/xo.png'>";
echo " </div>n";
echo " <div class='main'>n";
echo "Онлайн пользователи";
echo "</div>";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` != '$user[id]' AND `date_last` > '".(time()-600)."'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT `id` FROM `user` WHERE `id` != '$user[id]' AND `date_last` > '".(time()-600)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
$nnn = 0;
if ($k_post==0)
{
echo " <div class='gmenu'>n";
echo "Сейчас на сайте никого нетn";
echo " </div>n";
}
while ($ank = mysql_fetch_assoc($q))
{
echo '<table class="mess">';
echo '<td style="vertical-align: top;" width="3%">' . avatar($ank['id']) . '</td>';
echo '<td>' . group($ank['id']) . '';
echo " ".user::nick($ank['id'])."";
echo '' . online($ank['id']) . '</br>';
echo "<a href='?us=$ank[id]' ><i class='fas fa-dice'></i> Предложить играть</a>";
echo '</td></table>';
}
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
}
}
include_once '../../sys/inc/tfoot.php';
?>