Вход Регистрация
Файл: sport.php
Строк: 23
<?
session_start
();
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;
    }
}
    
$title "Спорт";
include 
'inc/head.php';
$id $_GET['id'];
$file file_get_contents('http://wap.championat.ru/'. (!empty($id) ? $id ''));
$file str_replace('href="/''href="?id='$file);
$file=preg_replace('|<!DOCTYPE(.*?)<body>|is''<div class="name">Спорт</div><div class="gr">',$file);

$file=preg_replace('|<script(.*?)</script>|is''',$file);
$file=str_replace('<img src="/''<img src="http://wap.championat.ru/'$file);

$file=preg_replace('|<!-- Footer -->(.*?)</html>|is''</div>',$file);
$file=str_replace('<a href="?id=img?src=''<a href = "' $file);
$file=str_replace('<div class="date">'''$file);
$file=str_replace('<h1 class="logo">''<h1 class="dd">'$file);
$file=preg_replace('|<!--(.*?)-->|is'''$file);
$file=preg_replace('|<a href="?id="><img src="http://wap.championat.ru/(.*?)</a>|is'''$file);

echo 
$file;
echo 
'<div class="links"><a href="/index.php">На главную</a></div>';
include (
'inc/foot.php');
?>
Онлайн: 1
Реклама