Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- error_reporting(0);
- /*
- @Coder: Linkgl
- @Fecha: 14/08/2011
- */
- function simpleono($cadena)
- {
- $p1=strpos($cadena,"\"");
- $p2=strpos($cadena,"'");
- if($p1!==false && $p2!==false)
- {
- if($p1<$p2)
- return $p1;
- else
- return $p2;
- }
- else
- return 0;
- }
- function searchanddestroy($cadena,$buscar,$separador)
- {
- $arr=explode($cadena,$separador);
- for($i=0;$i<count($arr);$i++)
- {
- if($arr[$i]==$buscar)
- return true;
- }
- return false;
- }
- function generador($direccion)
- {
- $p_inicio=$direccion;
- $enlaces=file_get_contents("enlaces.txt");
- $c_inicio=file_get_contents($p_inicio);
- $c1=strpos($c_inicio,"<a href=");
- //BUSCAMOS UN ENLACE
- while($c1!==false)
- {
- $curret_pos=$c1;
- //INTENTAMOS EXTRAER EL ENLACE
- $url=substr($c_inicio,$c1+9);
- $c2=simpleono($url);
- $enlaces=file_get_contents("enlaces.txt");
- if($c2!==false)
- {
- //echo $url."before";
- $url=substr($url,0,$c2);
- if(strpos($url,"http://")===0 || strpos($url,"www.")===0 || strpos($url,"https://")===0)
- {
- if($url!=$p_inicio)
- {
- if(strpos($enlaces,$url)===false)
- {
- $fp=fopen("enlaces.txt","a");
- fwrite($fp,$url."\n");
- fclose($fp);
- flush();sleep(1);flush();
- echo $url."<br>";
- generador($url);
- }
- }
- }
- else
- {
- $newurl=$p_inicio.$url; //lolz.com/#
- if($url!="")
- {
- if(searchanddestroy($enlaces,$newurl,"\n")===false && $url!="#")
- {
- $fp=fopen("enlaces.txt","a");
- fwrite($fp,$newurl."\n");
- fclose($fp);
- flush();sleep(1);flush();
- echo $newurl."<br>";
- generador($newurl);
- }
- }
- }
- }
- else
- {
- echo "Cierre de etiqueta no encontrado<br>";
- }
- $c1=strpos($c_inicio,"<a href=",$c1+1);
- }
- }
- if(!isset($_POST['sitioweb']) || empty($_POST['sitioweb']))
- {
- ?>
- <form action="#" method="post">
- <input type="text" name="sitioweb">
- <input type="submit" value="indexar!">
- </form>
- <?php
- }
- else
- {
- echo "Iniciando<br>";
- generador($_POST['sitioweb']);
- echo "No hay más enlaces<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment