Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> program indeksujacy (prosty lecz ma blad), HELPPPPPPPPPPPPPP mecze sie z tym od 11
szymon1551web
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 11.01.2011

Ostrzeżenie: (0%)
-----


Witam. napisałem program który indeksuje strony dziala wspaniale jak by przymknac oko na jeden maly blad jak na trafi na link i jest on w bazie danych to go zapisze a tak nie powinno byc dla was zawansowanych programistow to bulka z maslem ale ja tego bledu nie moge znalez od 4.5h mecze sie z tym od 11 wiec prosze pomozcie.
  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', 'miltu', '12345') or die("Brak polaczenia: " . mysql_error());
  7. $baza = mysql_select_db('kalorie',$polaczenie) or exit("Nie wybrano bazy, blad: " . mysql_error());
  8.  
  9. $sql="SELECT url FROM szukacz ORDER BY rand() LIMIT 1";
  10. $wynik = mysql_query($sql);
  11. $rekord=mysql_fetch_assoc($wynik);
  12. $url = $rekord['url'];
  13.  
  14. $liczy = "SELECT COUNT(*) as ile FROM szukacz WHERE url = ".$url."";
  15. $result = mysql_query($liczy);
  16. $arr = mysql_fetch_assoc($result);
  17. $tags = get_meta_tags($url);
  18. $content=file_get_contents($url);
  19. preg_match ('/<title>([^>]*)<\/title>/',$content,$title);
  20. preg_match_all('/<a.*href=\"([^\"]*)\".*>(.*)<\/a>/iU', $content, $links);
  21. echo $arr['ile'];
  22.  
  23. $a = iconv("utf-8", "iso-8859-2", $title[1]);
  24. $b = iconv("utf-8", "iso-8859-2", $tags['keywords']);
  25. $c = iconv("utf-8", "iso-8859-2", $tags['description']);
  26.  
  27. function sprawdz($url, $a, $b, $c, $arr) {
  28. if ($arr['url'] < 1) {
  29. //jezeli url nie istnieje robot go doda.
  30. if (!empty($a)) {
  31. if (!empty($c)) {
  32. if (!empty($b)) {
  33. $zapytanie = "INSERT INTO szukacz (url, title, klucz, opis, odslony, klikniecia) VALUES ('".$url."','".$a."','".$b."','".$c."',1,1)";
  34. $wynik = mysql_query($zapytanie) or die (mysql_error());
  35. }
  36. }
  37. }
  38. }
  39. else {
  40. // jezeli url istnieje robot go zaktualizuje.
  41. if (!empty($a)) {
  42. if (!empty($c)) {
  43. $update = "UPDATE szukacz SET 'title' = ".$a." opis = '".$c."' klucz ='".$b."' WHERE url ='".$url."'";
  44. $update_wykonac = mysql_query($update);
  45. }
  46. }
  47. }
  48. }
  49.  
  50. sprawdz($url, $a, $b, $c, $arr);
  51.  
  52. for ($i=1;$i<100;$i+=10) {
  53. $sprawdzenie = substr($links[1][$i],0,11);
  54. $sprawdzenie2 = substr($links[1][$i],0,7);
  55. $linki = $links[1][$i];
  56.  
  57. if ($sprawdzenie == ('http://www.') || $sprawdzenie2 == ('http://')) {
  58. $tags2 = get_meta_tags($linki);
  59. $content2 = file_get_contents($linki);
  60. preg_match ('/<title>([^>]*)<\/title>/',$content2,$title2);
  61. $d = iconv("utf-8", "iso-8859-2", $title2[1]);
  62. $e = iconv("utf-8", "iso-8859-2", $tags2['keywords']);
  63. $f = iconv("utf-8", "iso-8859-2", $tags2['description']);
  64. $liczy2 = "SELECT COUNT(*) as ile FROM szukacz WHERE url = ".$linki."";
  65. $result2 = mysql_query($liczy2);
  66. $arr2 = mysql_fetch_assoc($result2);
  67.  
  68. sprawdz($linki, $d, $e, $f, $arr2);
  69. }
  70.  
  71. else {
  72. $link = $url.$links[1][$i];
  73. $tags3 = get_meta_tags($link);
  74. $content3 = file_get_contents($link);
  75. preg_match ('/<title>([^>]*)<\/title>/',$content3,$title3);
  76. $g = iconv("utf-8", "iso-8859-2", $title3[1]);
  77. $h = iconv("utf-8", "iso-8859-2", $tags3['keywords']);
  78. $j = iconv("utf-8", "iso-8859-2", $tags3['description']);
  79.  
  80. $liczy3 = "SELECT COUNT(*) as ile FROM szukacz WHERE url = ".$link."";
  81. $result3 = mysql_query($liczy3);
  82. $arr3 = mysql_fetch_assoc($result3);
  83.  
  84. sprawdz($link, $g, $h, $j, $arr3);
  85. }
  86. }
  87.  
  88. ?>
  89. </body>
  90. </html>


troche bledow pewnie zawiera
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 19:00