Просмотр файла games/function.ini.php

Размер файла: 4.99Kb
<?php

    $Url = 'http://o5wap.ru/games/';

    if(isset($_GET['Mod']))
    {
    	$Url = 'http://o5wap.ru/games/'.$_GET['Mod'];
    }

    if(isset($_GET['Text']) and isset($_GET['Gde']))
    {
       $Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Text='.$_GET['Text'].'&Gde='.$_GET['Gde'];

        if(isset($_GET['Page']) and !isset($_GET['Order']))
        {
     	    $Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Page='.$_GET['Page'].'&Text='.$_GET['Text'].'&Gde='.$_GET['Gde'];
        }

        elseif(isset($_GET['Order']) and !isset($_GET['Page']))
        {
     	    $Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Order='.$_GET['Order'].'&Text='.$_GET['Text'].'&Gde='.$_GET['Gde'];
        }

        elseif(isset($_GET['Page']) and isset($_GET['Order']))
        {
     	    $Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Page='.$_GET['Page'].'&Order='.$_GET['Order'].'&Text='.$_GET['Text'].'&Gde='.$_GET['Gde'];
        }

    }

    elseif(isset($_GET['Page']) and !isset($_GET['Order']) and !isset($_GET['Text']) and !isset($_GET['Gde']))
    {
     	$Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Page='.$_GET['Page'];
    }

    elseif(isset($_GET['Order']) and !isset($_GET['Page']) and !isset($_GET['Text']) and !isset($_GET['Gde']))
    {
     	$Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Order='.$_GET['Order'];
    }

    elseif(isset($_GET['Page']) and isset($_GET['Order']) and !isset($_GET['Text']) and !isset($_GET['Gde']))
    {
     	$Url = 'http://o5wap.ru/games/'.$_GET['Mod'].'/?Page='.$_GET['Page'].'&Order='.$_GET['Order'];
    }

    $Url = Str_Replace("//", "/", $Url);
    $Url = Str_Replace("http:/", "http://", $Url);

    function o5wap_ru_GAMES($Url)
    {

        $File = file($Url);
        $Page = implode("", $File);

        if(!$Page)
        {
        	o5wap_ru_GAMES($Url);
            exit();
        }

        $Start   = strpos($Page, '<div class="h"><img class="icon" src="/Images/1/dwn.gif" alt=""/> Игры</div>');
        $Finish  = strpos($Page, '<div class="rek">');
        $Length  = $Finish-$Start;
        $Html    = substr($Page, $Start, $Length);
        $Html    = trim(STR($Html));

        print $Html;

    }

    function STR($Html)
    {
        $Html = Str_Replace("\n\n", "\n", $Html);

        $Html = Str_Replace("?Page",      "&amp;Page",  $Html);
        $Html = Str_Replace("?Order",     "&amp;Order", $Html);
        $Html = Str_Replace('/Images/1/', '../Images/', $Html);
        $Html = Str_Replace('dwn.gif',    'games.png',  $Html);
        $Html = Str_Replace('m.gif',      'next.png',   $Html);
        $Html = Str_Replace('dir.gif',    'folder.png', $Html);
        $Html = Str_Replace('sis.gif',    'sis.png',    $Html);
        $Html = Str_Replace('no_ico.gif', 'jar.png',    $Html);

        $Html = Str_Replace('/content',    'http://o5wap.ru/content', $Html);

        if(isset($_GET['Gde']))
        {
        	$Html = Str_Replace('<form action="">',    '<form action="index.php" method="get"><input type="hidden" name="Mod" value="'.$_GET['Mod'].'" /><input type="hidden" name="Order" value="'.$_GET['Order'].'" /><input type="hidden" name="Gde" value="'.$_GET['Gde'].'" /><input type="hidden" name="Text" value="'.$_GET['Text'].'" />', $Html);
        }
        else
        {
            $Html = Str_Replace('<form action="">',    '<form action="index.php" method="get"><input type="hidden" name="Mod" value="'.$_GET['Mod'].'" /><input type="hidden" name="Order" value="'.Order().'" />', $Html);
        }

        $Html = Str_Replace('<form action="/games/search/&amp;Page=1" method="post">',    '<form action="index.php" method="get"><input type="hidden" name="Mod" value="search" />', $Html);

        $Html = Str_Replace("\n\n", "\n", $Html);

        preg_match_all('|<a.* href=(.*)>(.*)</a>|U', $Html, $Sid);

        for($i = 0; $i < count($Sid[0]); $i++)
        {
            $Html = Str_Replace($Sid[1][$i], DelSid($Sid[1][$i]), $Html);
        }

        $Html = Str_Replace('?Mod=file', 'http://o5wap.ru/games/file', $Html);

        return $Html;
    }

    function DelSid($Link){

        $Link = Str_Replace('"', '', $Link);
        $Link = Str_Replace('/games/', '', $Link);
        $Link2 = $Link;

        $f    = strrpos($Link, '?sid=');

        if(eregi('&amp;sid=', $Link))
        {
        	$f    = strrpos($Link, '&amp;sid=');
        }

        $ext  = strtolower(substr($Link,$f));
        $Link = Str_Replace($ext, '', $Link);

        $Link = '"?Mod='.$Link.'"';
        if($Link == '"?Mod="') $Link = '"index.php"';

        return $Link;
    }

    function Order()
    {
    	$Order = parse_url($_GET['Mod']);
        $Order = $Order['query'];

        if(eregi('Order', $Order))
        {
           $OrderCut = strrpos($Order,'Order=');
           $Order    = preg_replace("/[^0-9]/", "", substr($Order,$OrderCut));
        }

        else
        {
            $Order = '';
        }

        return $Order;
    }

?>