Файл: game.php
Строк: 20
<?
session_start();
$title = "Игры";
include ('inc/db.php');
include 'inc/functions.php';
if (isset($_SESSION['user_id']))
{
    $query = "SELECT *
                FROM `user`
                WHERE `id_user`='{$_SESSION['user_id']}'
                LIMIT 1";
    $sql = mysql_query($query) or die(mysql_error());
    $row = mysql_fetch_assoc($sql);
    // если нету такой записи с пользователем
    // ну вдруг удалили его пока он лазил по сайту.. =)
    // то надо ему убить ID, установленный в сессии, чтобы он был гостем
    if (mysql_num_rows($sql) != 1)
    {
        header('Location: index.php?logout');
        exit;
    }
}else{ 
        header('Location: index.php?logout');
}
 include ('inc/head.php');
?>
<div class="re">
• <a href="ugadai.php">Угадай число</a><br />
• <a href="naperstki.php">Наперстки</a><br />
</div>
<div class="links"><a href="index.php">На главную</a></div>
<?
 include ('inc/foot.php');
?>