<!-- Файл pachType.php --> <HTML> <HEAD><STYLE TYPE="text/css" TITLE=""> input.s {width:200pt}; input.type {width:40pt}; </STYLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=Windows-1251"> </HEAD> <BODY> <form name="" action="pachType.php" method="post"> <TABLE> <TR><TD>Ссылка </TD><TD> <input name="links" type="text" value="" class="s"> </TD></TR> <TR><TD>Тип файлов </TD><TD><input name="type" type="text" value="" class="type"></TD></TR></TABLE> <input type="submit" value="Показать"> </form> <? if (isset($_POST['links'])) $link = $_POST['links']; if (isset($_POST['type'])) $exten = $_POST['type']; if (empty($exten) || empty($link)) exit("Ogo xyu!\n"); $out = array(); foreach (explode(",", $exten) as $value) { if (@$value) $out[] = trim($value); } if ($out) $exten = implode("|", $out); else exit("Ogo xyu!\n"); // PLEASE REMOVE IT function get_contents($fullpath, $PROXY="127.0.0.1", $port=80) { //$PROXY = "cache"; $line = ""; $fp = fsockopen($PROXY, $port, $errno, $errstr, 30); if (!$fp) echo "$errstr($errno)<br />\n"; else { $authorization=base64_encode("login:password"); $headers = "GET $fullpath HTTP/1.1\r\n"; $headers.="Basic-Authorization: $authorization\r\n"; // $headers .= "Host: $hostname\r\n"; $headers .= "Connection: Close\r\n\r\n"; fwrite($fp, $headers); while (!feof($fp)) { $line .= fgets($fp, 1024); } fclose ($fp); } return $line; } //////////////////////////////////////// set_time_limit(0); function URL_link($link_file, $exten) { $l= parse_url($link_file); /* при использовании прокси надо использовать get_contents при использовании прокси надо использовать file_get_contents при при соединении БЕЗ прокси */ $text = file_get_contents($link_file ); //$text = get_contents($link_file, "127.0.0.1", 80); preg_match_all("!<A[^>]+HREF=\"?'?([^ \"'>]+($exten))\"?'?[^>]*>(.*?)</a>!is",$text,$ok); for ($i=0; $i<count($ok[1]); $i++) { if (!ereg("^\/.*",$ok[1][$i])) { $url = $link_file.$ok[1][$i]; echo "<a href='$url'>$url</a><br />"; } } preg_match_all("!<A[^>]+HREF=\"?'?([^ \"'>]+)/\"?'?[^>]*>(.*?)</a>!is",$text,$ok); for ($i=0; $i<count($ok[1]); $i++) { if( !ereg("^http",$ok[1][$i]) && !ereg("^/",$ok[1][$i]) ) { // echo "DIR: ".$link_file.$ok[1][$i]."<br />"; flush(); URL_link ($link_file.$ok[1][$i]."/",$exten); } } } URL_link($link, $exten); ?> </BODY></HTML> |