Вход Регистрация
Файл: chart/chart/index.php
Строк: 88
<?php

/**
 * Эксклюзивные скрипты и шаблоны только на GearNet.ru
 * GearNet.ru - Сообщество мастеров!
 */
#Developed by http://gearnet.ru/users/1

define('DIRK', '/chart/'); //папка с скриптом (/papka/), если в корне - ставим слеш /
define('HOME', 'http://' . $_SERVER['HTTP_HOST'] . DIRK);

$COPYRIGHT = 'GearNet_ru_'; //Префикс в названиях файлов
$TOP_CHART = 'SITE MY'; //Имя "вашего" чарта


function head()
{
    global 
$res, $tits;
    
preg_match('#<title>(.*)</title>#Usi', $res, $tits);
    
$tits[1] = str_replace('| ТОП ЧАРТЫ', '', $tits[1]);
    
$title = $tits[1];
    require 
'head.php';
}

function 
foot()
{

echo 
'<div class="title"> Реклама</div>
<div class="i_bar_t">&bull;  <a href="' 
. htmlspecialchars(getenv("HTTP_REFERER")) . '">Назад</a>
&bull; <a href="/">На главную</a> </div>
<div class="foot">Developed by LoginIP</div>
</body>
</html>'
;
}

$act = isset($_GET['act']) ? $_GET['act'] : null;
switch (
$act)
{

    default:
        
$file_id = isset($_GET['file_id']) ? $_GET['file_id'] : '';
        
$page = isset($_GET['start']) ? $_GET['start'] : 0;
        
$id = isset($_GET['id']) ? $_GET['id'] : '';
        
$idc = isset($_GET['idc']) ? $_GET['idc'] : '';


        function 
getpag($url) {
            global 
$TOP_CHART;
            
$curl = curl_init();
            
curl_setopt($curl, CURLOPT_URL, $url);
            
curl_setopt($curl, CURLOPT_USERAGENT,
                
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36 OPR/25.0.1614.68');
            
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
            
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            
curl_setopt($curl, CURLOPT_REFERER, 'http://wap.sasisa.ru/charts/');
            
$res = curl_exec($curl);
            
$res = str_replace('SaSiSa', $TOP_CHART, $res);
            
$res = preg_replace('#&amp;sid=.*"#siU', '"', $res);

            
curl_close($curl);

            return 
$res;
        }
        if (!
$idc and !$id)
        {
            
$res = getpag('http://wap.sasisa.ru/charts/index.php?mod=&start=' . $page);
            
preg_match('#<br/>Страница:(.*)</div><div class="c2">#Usi', $res, $nav);
            
$nav = str_replace('/charts/index.php?mod=&amp;start=', '?start=', $nav);
            
head();
            echo 
'<div class="title">Чарты</div>';
            
preg_match_all('#<div class="item">.*href="/charts/index.php.*mod=chart&amp;.*(.*)">(.*)</a>#Usi', $res, $out, PREG_SET_ORDER);
            foreach (
$out as $k => $v)
            {
                echo 
'
            <div class="i_bar_t"><a href="' 
. HOME . 'index.php?' . $v[1] . '">' . $v[2] . '</a>' . strip_tags($v[3]) . '</div>
            '
;
            }
        }
        if (!
$file_id)
        {
            if (
$idc)
            {
                
$res = getpag('http://wap.sasisa.ru/charts/index.php?mod=chart&idc=' . $idc . '&start=' . $page);
            } else
                if (
$id)
                {
                    
$res = getpag('http://wap.sasisa.ru/charts/index.php?mod=chart&id=' . $id . '&start=' . $page);

                }
            if (
$idc || $id)
            {

                
preg_match('#<br/>Страница:(.*)</div><div class="c2"><b><a#Usi', $res, $nav);
                
$nav = str_replace('/charts/index.php?mod=chart&amp;', '?', $nav);
                
head();
                echo 
'<div class="title">Чарт ' . $tits[1] . '</div>';
                
preg_match_all('#<div class="item">.*href.*alt="скачать.*href="/charts/index.php.*mod=info&amp;(.*)">(.*)<br />#Usi', $res, $out, PREG_SET_ORDER);
                
$nav = str_replace('', '?', $nav);
                foreach (
$out as $k => $v)
                {
                    echo 
'
            <div class="i_bar_t"><a href="' 
. HOME . 'index.php?' . $v[1] . '">' . $v[2] . '</a>' . strip_tags($v[3]) . '</div>
            '
;
                }

            }
        }

        if (
$file_id)
        {
            if (
$idc)
                
$var_id = 'idc=' . $idc;
            else
                
$var_id = 'id=' . $id;

            
$res = getpag('http://wap.sasisa.ru/charts/index.php?mod=info&' . $var_id . '&file_id=' . $file_id);
            
preg_match('#<b>Чарт:</b>.*">(.*)</a>#Usi', $res, $chart);
            
preg_match('#<b>Исполнитель:</b>(.*)<br/>#Usi', $res, $ispolnitel);
            
preg_match('#<b>Композиция:</b>(.*)<a#Usi', $res, $kompozitsiya);
            
preg_match('#<b>Длительность:</b>(.*)<br />#Usi', $res, $dlitelnost);
            
preg_match_all('#img/dl.gif.*href="/charts/index.php.*mod=load&amp;.*download_file=(.*)">(.*)</a>(.*)<br />#Usi', $res, $out, PREG_SET_ORDER);

            
head();
            echo 
'<div class="title">' . $ispolnitel[1] . '</div>';
            echo 
'<div class="i_bar_t">Чарт: ' . $chart[1] . '</div>';
            echo 
'<div class="i_bar_t">Исполнитель: ' . $ispolnitel[1] . '</div>';
            echo 
'<div class="i_bar_t">Композиция: ' . $kompozitsiya[1] . '</div>';
            echo 
'<div class="i_bar_t">Длительность: ' . $dlitelnost[1] . '</div>';
            echo 
'<div class="i_bar_t"><b>Слушать онлайн</b><br/><audio preload="none"><source src="http://wap.sasisa.ru' . $out[1][1] . '"></audio> </div>';

            echo 
'<div class="title">Скачать песню</div>';
            foreach (
$out as $k => $v)
            {
                echo 
'
            <div class="i_bar_t"><a href="' 
. HOME . '?act=load&id=' . base64_encode($v[1]) . '">' . $v[2] . '</a>' . strip_tags($v[3]) . '</div>
            '
;
            }

        }

        if (
$nav[1])
        {
            echo 
'<div class="i_bar_t">Навигация: ' . $nav[1] . '</div>'; #навигация
        
}
        
foot();

        break;

    case 
'load':

        
$url = isset($_GET['id']) ? 'http://wap.sasisa.ru' . base64_decode($_GET['id']) : null;
        
$file = $url;
        
$url = $url;

        
$finfo = new SplFileInfo($file);
        
$fn = $finfo->getFilename();
        if (
$h = get_headers($url, 1))
        {
            if (!empty(
$h['Location']))
            {
                
$url = $h['Location'];
                
$h = get_headers($url, 1);
            }
            if (
ob_get_level())
                
ob_end_clean();
            
$fn = str_replace('wap_sasisa_ru_', '', $fn);
            
header('Content-Description: File Transfer');
            
header('Content-Type: audio/mpeg');
            
header('Content-Disposition: attachment; filename=' . $COPYRIGHT . $fn);
            
header('Content-Transfer-Encoding: binary');
            
header('Expires: 0');
            
header('Cache-Control: must-revalidate');
            
header('Pragma: public');
            
header('Content-Length: ' . $h['Content-Length']);
            
readfile($file) . exit;
        } else
        {
            
header('location: ' . $file) . exit;
        }

        break;
}
/**
 * Эксклюзивные скрипты и шаблоны только на GearNet.ru
 * GearNet.ru - Сообщество мастеров!
 */

?>
Онлайн: 1
Реклама