Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Pajaczek(bot indeksujacy) robi dziwne linki POMOZCIE
Forum PHP.pl > Forum > PHP
szymon1551web
Witam kod juz nie wpisuje kilka razy tego samego linku smile.gif. lecz teraz to juz sie zalamalem np jest link http://www.forum.php.pl/index.php a on mi dodaje cos takiego... http://www.forum.php.pl/index.php/index.ph...php?do=new_post. dziwne koncowki robi po 20 min testowania takie cos zalwazylem. zmienilem petle na foreach lepiej wydajniej chodzi lecz nadal koncowki linkow kopiuje... pomozcie bede bardzo wdzieczny i jakbyscie mieli jakies uwagi do kodu to napiszcie. Moze jest jakis lepszy sposob na indeksowanie stron ?
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />
  3. </head>
  4. <body>
  5. <?php
  6. $polaczenie = mysql_connect('localhost', 'XXX', '12345') or die("Brak polaczenia: " . mysql_error());
  7. $baza = mysql_select_db('XXX',$polaczenie) or exit("Nie wybrano bazy, blad: " . mysql_error());
  8.  
  9.  
  10. $sql="SELECT url FROM szukacz ORDER BY rand() LIMIT 1";
  11. $wynik = mysql_query($sql);
  12. $rekord=mysql_fetch_assoc($wynik);
  13. $url = $rekord['url'];
  14.  
  15. function sprawdz($url, $a, $b, $c) {
  16. //liczy ile linkow jest w bazie danych
  17. $result = mysql_query("SELECT COUNT(*) as ile FROM `szukacz` WHERE `url` = '".$url."'");
  18. $arr = mysql_fetch_assoc($result);
  19. if ($arr['ile'] == 1) {
  20.  
  21. if (!empty($a)) {
  22. if (!empty($c)) {
  23. $update = "UPDATE szukacz SET 'title' = ".$a." opis = '".$c."' klucz ='".$b."' WHERE url ='".$url."'";
  24. $update_wykonac = mysql_query($update);
  25. }
  26. }
  27. }
  28.  
  29.  
  30. if ($arr['ile'] <= 0) {
  31.  
  32. //jezeli url nie istnieje robot go doda.
  33. if (!empty($a)) {
  34. if (!empty($c)) {
  35. if (!empty($b)) {
  36. $zapytanie = "INSERT INTO szukacz (url, title, klucz, opis, odslony, klikniecia) VALUES ('".$url."','".$a."','".$b."','".$c."',1,1)";
  37. $wynik = mysql_query($zapytanie) or die (mysql_error());
  38. }
  39. }
  40. }
  41. }
  42. }
  43.  
  44. $tags = get_meta_tags($url);
  45. $content=file_get_contents($url);
  46. preg_match ('/<title>([^>]*)<\/title>/',$content,$title);
  47. preg_match_all('/<a.*href=\"([^\"]*)\".*>(.*)<\/a>/iU', $content, $links);
  48.  
  49. $a = iconv("utf-8", "iso-8859-2", $title[1]);
  50. $b = iconv("utf-8", "iso-8859-2", $tags['keywords']);
  51. $c = iconv("utf-8", "iso-8859-2", $tags['description']);
  52.  
  53. sprawdz($url, $a, $b, $c);
  54.  
  55. foreach($links[1] as $adres) {
  56. $sprawdzenie = substr($adres,0,11);
  57. $sprawdzenie2 = substr($adres,0,7);
  58.  
  59. if ($sprawdzenie == ('http://www.') || $sprawdzenie2 == ('http://')) {
  60. $tags2 = get_meta_tags($adres);
  61. $content2 = file_get_contents($adres);
  62. preg_match ('/<title>([^>]*)<\/title>/',$content2,$title2);
  63. $d = iconv("utf-8", "iso-8859-2", $title2[1]);
  64. $e = iconv("utf-8", "iso-8859-2", $tags2['keywords']);
  65. $f = iconv("utf-8", "iso-8859-2", $tags2['description']);
  66. sprawdz($adres, $d, $e, $f);
  67. unset($tags2, $content2, $adres);
  68.  
  69. }
  70.  
  71.  
  72. // w przeciwnym razie ...
  73. else {
  74.  
  75. $tags3 = get_meta_tags($url.$adres);
  76. $content3 = file_get_contents($url.$adres);
  77. preg_match ('/<title>([^>]*)<\/title>/',$content3,$title3);
  78. $g = iconv("utf-8", "iso-8859-2", $title3[1]);
  79. $h = iconv("utf-8", "iso-8859-2", $tags3['keywords']);
  80. $j = iconv("utf-8", "iso-8859-2", $tags3['description']);
  81. sprawdz($url.$adres, $g, $h, $j);
  82. unset($tags3, $content3, $adres);
  83.  
  84.  
  85. }
  86.  
  87. }
  88. ?>
  89. <script type="text/javascript">
  90. window.location = "kopia.php"
  91. </script>';"
  92. </body>
  93. </html>
wookieb
Kontynuuj wywód w ostatnim temacie.
http://forum.php.pl/index.php?showtopic=167656&hl=
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.