Code for Last 10 Searches (mp3 search)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Code for Last 10 Searches (mp3 search)

    Hello guys! can anyone pls help me to create a last 10 searches in mp3 search this my index.php

    <?
    include'config.php';
    $q = $_GET['q'];
    $q = str_replace('"', "'", $q);
    $q = str_replace(' ', "+", $q);
    $q = stripslashes($q);
    $val = $_GET['q'];
    $val = str_replace('_',' ',$val);
    $var = str_replace(' ','_',$val);

    if(isset($_GET['page'])){ $page = $_GET['page']; }
    if(!isset($_GET['page'])){ $page = 0; }
    if(isset($_GET['hal'])){
    if($_GET['hal'] > 0) { $page = ($_GET['hal']-1)*10; }
    }

    $p = $page;

    if (!empty($val)){
    $title = $val;
    }else{
    $title = 'Mp3 Music Download';
    }?>
    <?
    $file = file('http://search.4shared.com/network/searchXml.jsp?sortType=1&sortOrder=1&sortmode=3&q= '.str_replace(' ','+',$q).'&searchmode=3&searchDescription=&search Extention=mp3&sizeCriteria=atleast&sizevalue=10&st art='.$page);

    $mybe = $q;
    $mungkin1 = 'http://www.google.com/m/search?hl=id&q='.str_replace('_','+',$mybe);

    $mungkin2 = file_get_contents($mungkin1);
    $mung = explode('/gwt/x?q',$mungkin2);
    $mungk= cut($mungkin2,'Mungkin maksud Anda adalah:','</a> </div> <div class="edewpi" id="universal">');
    $mungkin= cut($mungk,'&amp;q=','&amp;spell');

    $file = @implode("",$file);
    $total = cut($file,'<total-files>','</total-files>');
    $toth = ceil($total/10);
    $count = $total / 10;
    $now = ($page/10)+1;
    $h = ($hlm-1)*10;

    if(!empty($q) && empty($_GET['hal'])){
    $gq = str_replace('+','_',$q);
    header("location:/$gq-p1.html");
    }


    $strt =strstr($file,'<result-files>');
    $exp = explode('<file>',$strt);

    ?>
    <?include"head.php";?>
    <!--content -->
    Search Artist or Song title : <br/>
    <form method="get" action="/">
    <input type="text" name="q" value="<?echo $val;?>"><input type="submit" value="Search" /></form><br/>

    <?

    if (!empty($total)){
    $val = str_replace('_',' ',$val);
    echo '<div class="result">'.$total.' results for '.str_replace('+',' ',$val).'</div>';
    }else{
    echo '<div class="result">No results for '.str_replace('+',' ',$val).'</div>';
    }
    if (empty($q)){
    echo '<div class="result">Last Updates</div>';
    }

    if (!empty($mungkin)){
    echo '<div class="result">Dead you mean <a href=/'.str_replace('+','_',$mungkin).'.html>'.str_repla ce('+',' ',$mungkin).'</a>?</div>';
    }
    ?>

    <?
    for($i = 1; $i <= 10; $i++){

    $name = cut($exp[$i],'<name>','</name>');
    $output = preg_replace("/\W/e","_",$name);
    $name = strtolower($name);
    $name = ucfirst($name);
    $vname = valid($name);
    $vname = str_replace('-mp3','.htm',$vname);

    $size = cut($exp[$i],'<size>','</size>');
    $purl = cut($exp[$i],'<flash-preview-url>','</flash-preview-url>');
    $url = cut($exp[$i],'<url>','</url>');
    $id = explode('/',$url);

    if (!empty($name)){
    if($now <= $toth) {
    echo '<a href="/view/'.$id[4].'/'.str_replace(' ','_',$vname).'" target="_top">'.$name.'</a> <font size="small">('.$size.')</font><br/>';
    }
    }
    }

    if(!empty($total)){
    $nextpage = $p + 10;
    $prevpage = $p - 10;
    $nexthal = $now + 1;
    $prevhal = $now -1;
    $nextpage = '/'.str_replace('+','_',$q).'-p'.$nextpage.'.html';
    $prevpage = '/'.str_replace('+','_',$q).'-p'.$prevpage.'.html';
    $nexthal = '/'.str_replace('+','_',$q).'-p'.$nexthal.'.html';
    $prevhal = '/'.str_replace('+','_',$q).'-p'.$prevhal.'.html';

    echo '<div class=page>';
    echo " Page $now/$toth<br/>";

    if ( $now > 1 )
    {
    echo "<a href=\"";
    echo $prevhal;
    echo "\">";
    echo '&#171; Prev | ';
    echo "</a>";
    }else{
    echo ' &#171; Prev | ';}

    if ( $i != 1 )
    {
    if($now != $toth) {
    echo "<a href=\"";
    echo $nexthal;
    echo "\">";
    echo 'Next &#187;';
    echo "</a>";
    }else{
    echo ' Next &#187; ';
    }
    }

    echo '</div>';
    }?>
    <?include"foot.php";?>
Working...
X