Search Files

array('header' => 'User-Agent: '.$useragent.'')); $context = stream_context_create($opts); $contents = @file_get_contents($url, false, $context) or die('Error'); return $contents; break; default: return 'Please enable curl, fsockopen or file_get_contents!'; break; } } $max = 10; // last search max $file = 'last.txt'; // last search file $data = file($file); $count = count($data); //* Begin Display Last Search *// echo '

Last Search:
'; $titles = array_reverse($data); foreach($titles as $title) { $title = rtrim($title); echo ''.htmlspecialchars($title).' / '; } echo '

'; //* End Display Last Search *// $q = @urlencode($_GET['q']); $dl = @$_POST['dl']; if ($q) { //* Begin Write Last Search *// $q1 = $_GET['q']."\r\n"; if (in_array($q1, $data)) { unset($data[array_search($q1, $data)]); $write = implode($data).$q1; $fh = fopen($file, 'w'); fwrite($fh, $write); fclose($fh); } else { if ($count >= $max) array_shift($data); array_push($data, $q1); $write = implode($data); $fh = fopen($file, 'w'); fwrite($fh, $write); fclose($fh); } if ($count > $max) { $fh = fopen($file, 'w'); $write = implode(array_slice($data, $count-$max)).$q1; fwrite($fh, $write); fclose($fh); } //* End Write Last Search *// $p = @intval($_GET['p']); $start = 10 * $p; $contents = get_contents('http://search.4shared.com/network/searchXml.jsp?q='.$q.'&start='.$start); $tf = explode('', $contents); $tf = strtok($tf[1], '<'); $pt = explode('', $contents); $tp = strtok($pt[1], '<'); $name = explode('', $contents); $size = explode('', $contents); $url = explode('', $contents); $count = count($name) - 1; echo '
Files Found: '.$tf.' ('.($start+1).'-'.($start+$count).')
    '; if ($count) { for($i=1; $i<=$count; $i++) { $file = strtok($name[$i], '<'); $url_encoded = base64_encode(gzdeflate(trim(strtok($url[$i], '<')), 9)); echo '
  • '.$file.' ('.strtok($size[$i], '<').')'; echo (pathinfo(strtolower($file), PATHINFO_EXTENSION) == 'mp3') ? '
  • ' : '
    • Download
    '; } } else { echo '
  • No file(s) match for "'.htmlspecialchars($_GET['q']).'"
  • '; } echo '
'; } elseif ($dl) { $url = gzinflate(base64_decode(($dl))); $html = get_contents($url); libxml_use_internal_errors(true); $doc = new DomDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $metas = $xpath->query('//meta[@property="og:url"]'); foreach($metas as $meta) $property = $meta->getAttribute('content'); echo ''; } ?>