Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Parse error: syntax error, unexpected $end in /home/accounts_a/ad4m/public_html/funkcje.php on line 1, Błąd
Ad4m1992
post
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 1
Dołączył: 3.03.2007

Ostrzeżenie: (20%)
X----


Witam. Ostatnio mam problem z wgraniem tego skryptu na serwer. Wyświetla mi się błąd i nie wiem gdzie jest ten błąd

Oto kawałek kodu.

  1. <?php
  2.  function trimBody($theText, $lmt=300, $s_chr='\n', $s_cnt=5){
  3. $pos = 0;
  4. $trimmed = FALSE;
  5. for ($i = 1; $i <= $s_cnt; $i++){
  6. if ($tmp = strpos($theText, $s_chr, $pos+1)){
  7. $pos = $tmp;
  8. $trimmed = TRUE;
  9. }else{
  10. $pos = strlen($theText) - 1;
  11. $trimmed = FALSE;
  12. break;
  13. }
  14. }
  15. $theText = substr($theText, 0, $pos);
  16.  
  17. if (strlen($theText) > $lmt) {
  18. $theText = substr($theText, 0, $lmt);
  19. $theText = substr($theText, 0, strrpos($theText,' '));
  20. $trimmed = TRUE;
  21. }
  22. if ($trimmed) $theText .= '...';
  23. return $theText;
  24. }
  25.  
  26. function outputStory($artykul, $only_snippet=FALSE) {
  27. global $conn;
  28.  
  29. if ($artykul) {
  30. $sql = "SELECT ar.*, uz.login, uz.uzytkownik_id " .
  31.  "FROM artykuly ar " .
  32.  "LEFT OUTER JOIN uzytkownicy uz " .
  33.  "ON ar.autor_id = uz.uzytkownik_id " .
  34.  "WHERE ar.artykul_id = " . $artykul ;
  35. $result = mysql_query($sql,$conn);
  36. // AUTOR
  37. if ($row = mysql_fetch_array($result)) {
  38. echo "<div id=\"tytul\">" . htmlspecialchars($row['tytul']) . "</div>\n";
  39. echo "<div id=\"autor\">Autor: " .
  40.  "<A href=\"authorinfo.php?uzytkownik_id=" . $row['uzytkownik_id'] . "\">" .
  41.  htmlspecialchars($row['login']). "</a>";
  42. echo " &nbsp &nbsp &nbsp &nbsp  ";
  43.  
  44. // DATA
  45. if ($row['opublikowany'] == 1) {
  46. echo date("Y-m-d",strtotime($row['data_opublikowania']));
  47.  
  48. } else {
  49. echo "nieopublikowany";
  50. }
  51. echo " &nbsp &nbsp &nbsp &nbsp  ";
  52. // RODZAJ
  53. $sql1= "SELECT rodzaj_nazwa, rodzaj_id " .
  54. "FROM rodzaje " .
  55. "WHERE rodzaj_id=" . $row['rodzaj_id'];
  56. $result1= mysql_query($sql1);
  57. $row1 = mysql_fetch_array($result1);
  58.  
  59. echo "Rodzaj: <a href=\"art_" . strtolower($row1['rodzaj_nazwa']) . ".php\">" . $row1['rodzaj_nazwa'] . "</a>" ;
  60. echo " &nbsp &nbsp &nbsp &nbsp  ";
  61.  
  62. // STATUS
  63. $sql3 = "SELECT status_id, status_nazwa " .
  64. "FROM statusy " .
  65. "WHERE status_id=" . $row['status_id'];
  66. $result3=mysql_query($sql3);
  67. $status=mysql_fetch_array($result3);
  68.  
  69. echo "Status: ";
  70. switch ($status['status_id']) {
  71. case 1:
  72. echo "<a href=wszystkie_akt.php>";
  73. break;
  74. case 2:
  75. echo "<a href=wszystkie_art.php>";
  76. break;
  77. }
  78. echo $status['status_nazwa'];
  79. echo "</a>";
  80.  
  81. // KOMENTARZE
  82. $sql2= "SELECT komentarz_id " .
  83.  "FROM komentarze " .
  84.  "WHERE artykul_id=" .$artykul;
  85. $result2=mysql_query($sql2);
  86. $ile1=mysql_num_rows($result2);
  87.  echo " &nbsp &nbsp &nbsp &nbsp  ";
  88.  echo "Komentarze: " . $ile1;
  89.  echo "<br>";
  90.  echo "<br>";
  91. echo "<font size=2px>";
  92.  
  93. // ŹRÓDŁO
  94.  
  95. echo "Źródło: " . $row['zrodlo'];
  96.  
  97. echo "&nbsp;&nbsp;&nbsp;&nbsp;";
  98.  
  99. //WWW
  100.  
  101. if(isset($row['www'])) {
  102. echo " <a href=http://" . $row['www'] . ">" . $row['www'] . "</a>";
  103. }
  104. echo "</font>";
  105. echo "</div>";
  106. echo "\n";
  107.  
  108. // TRESC
  109.  
  110. if ($only_snippet) {
  111. echo "<div id=\"tresc\"><p>\n";
  112. echo nl2br(trimBody($row['tresc']));
  113. echo "</p></div>";
  114. echo "<div id=\"caly\"><a href=\"viewarticle.php?artykul=" .
  115.  $row['artykul_id'] . "\">Cały artykuł...</a></div>";
  116. } else {
  117. echo "<div id=\"tresc\"><p>\n";
  118. echo nl2br($row['tresc']);
  119. echo "</p></div>\n\n";
  120.  
  121. }
  122. }
  123. }
  124. }
  125. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 06:05