Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] problem z funkcją include...
paffel
post 25.06.2008, 17:17:05
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Witam,
mam pewien problem, którego za nic nie potrafię rozwiązać...
http://www.differ.home.pl/forum/lasttopic.php - wszystko jest ok, pobiera tematy z bazy... ale gdy próbuję ten plik includ'ować na stronę główną:
http://www.differ.home.pl - pojawia się taki błąd... o co chodzi?

Na innym serwerze działa bez problemu: http://www.differ.pl
Z góry dzięki za pomoc.
Go to the top of the page
+Quote Post
Pride
post 25.06.2008, 18:15:57
Post #2





Grupa: Zarejestrowani
Postów: 139
Pomógł: 11
Dołączył: 31.01.2005
Skąd: Bydgoszcz

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


Pewnie pokręciłeś ścieżki smile.gif


--------------------
Kto pyta - nie błądzi, kto szuka - znajduje.
Go to the top of the page
+Quote Post
paffel
post 25.06.2008, 19:38:40
Post #3





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Niestety wszystko jest ok worriedsmiley.gif
Go to the top of the page
+Quote Post
lilik
post 25.06.2008, 20:18:19
Post #4





Grupa: Zarejestrowani
Postów: 66
Pomógł: 5
Dołączył: 17.03.2005

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


pewnie jak wkleisz kod to latiwej bedzie stwierdzic smile.gif
Go to the top of the page
+Quote Post
matx132
post 25.06.2008, 20:26:30
Post #5





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


z tego błedu wynika ze chyba include ronbisz przez link
sprobój

include('forum/lasttopic.php');

Ten post edytował matx132 25.06.2008, 20:26:42
Go to the top of the page
+Quote Post
paffel
post 25.06.2008, 22:11:10
Post #6





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Kod pliku lasttopic.php
  1. <?
  2. /** 
  3. * newest_posts - raw dump of newest posts from forum
  4. *
  5. * @copyright (c) 2008 ameeck / Vojtech Vondra - phpBB.cz
  6. * @license <a href=\"http://opensource.org/licenses/gpl-license.php\" target=\"_blank\">http://opensource.org/licenses/gpl-license.php</a> GNU Public License 
  7. */
  8. define('IN_PHPBB', true);
  9. $phpbb_root_path = './';
  10. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  11. include($phpbb_root_path . 'common.' . $phpEx);
  12.  
  13. // Start session management
  14. $user->session_begin();
  15. $auth->acl($user->data);
  16. $user->setup();
  17.  
  18. // Number of posts and grabbing permissions
  19. // Počet příspěvků pro zobrazení a oprávnění
  20. $topic_limit = request_var('topic_limit', 6);
  21. $forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
  22.  
  23. // Select the last topics to which we have permissions
  24. // Vybrat poslední témata ke kterým máme oprávnění
  25. $sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.usernam
  26.  
  27. FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u
  28. WHERE post_approved = 1
  29. AND ' . $db->sql_in_set('forum_id', $forums) . '
  30. AND u.user_id = p.poster_id
  31. ORDER BY post_time DESC
  32. LIMIT 0,' . $topic_limit;
  33. $result = $db->sql_query($sql);
  34. // Now let's output the content
  35. // A teď vypsat obsah
  36. echo '<div id="post_content" align="left"><ul>';
  37. while ($row = $db->sql_fetchrow($result))
  38. {
  39. $url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}";
  40. echo '<li><a target="_top" href="' . $url . '">' . iconv("UTF-8","ISO-8859-2",$row['post_subject']) . ' | ' .
  41.  $user->format_date($row['post_time']) . '</a><br /> </li>';
  42. }
  43. echo '</ul></div>';
  44. ?>

A tak wygląda include w pliku index.php
  1. <?php
  2. include ("http://www.differ.home.pl/forum/lasttopic.php");
  3. ?>


http://www.differ.home.pl/forum/lasttopic.php - sam plik działa...

Próbowałem tak:
  1. <?php
  2. include ("forum/lasttopic.php");
  3. ?>

nie działa.

http://www.differ.home.pl/php/index.rar - plik index.php z funkcją include.

Ten post edytował paffel 25.06.2008, 22:12:14
Go to the top of the page
+Quote Post
tomsi
post 25.06.2008, 22:44:34
Post #7





Grupa: Zarejestrowani
Postów: 379
Pomógł: 45
Dołączył: 30.06.2007

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


Moim zdaniem coś masz chyba źle w bibliotece PEAR.


--------------------
Jeśli Ci pomogłem kliknij "Pomógł"
Jeśli Ty mi pomogłeś kliknę "Pomógł"
Go to the top of the page
+Quote Post
paffel
post 25.06.2008, 23:16:29
Post #8





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


To teraz jakaś szybka rada? smile.gif
Czy to wina hostingu? Bo na innym działa bez problemu...
Go to the top of the page
+Quote Post
artega
post 26.06.2008, 09:01:28
Post #9





Grupa: Zarejestrowani
Postów: 174
Pomógł: 42
Dołączył: 22.07.2007
Skąd: /dev/random

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


Wystarczy spojrzeć do dokumentacji o konstrukcji include i przeczytać o allow_url_fopen. Prawdopodobnie hosting nie zezwala na zdalne włączanie pliku. Stosuj jedynie włączenia lokalne.
Go to the top of the page
+Quote Post
Spykaj
post 26.06.2008, 09:35:00
Post #10





Grupa: Zarejestrowani
Postów: 104
Pomógł: 3
Dołączył: 30.05.2008
Skąd: Białystok

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


Spróbuj dać:

include("./forum/lasttopic.php");


--------------------
?>
Go to the top of the page
+Quote Post
paffel
post 26.06.2008, 11:11:05
Post #11





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Wrzuciłem:
  1. <?php
  2. include("./forum/lasttopic.php");
  3. ?>

Teraz wywala inny błąd i strona się rozjeżdża...
Go to the top of the page
+Quote Post
piotrooo89
post 26.06.2008, 11:12:01
Post #12


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




hmmm... może podasz o czym "mówi" błąd?


--------------------
Go to the top of the page
+Quote Post
paffel
post 26.06.2008, 11:21:41
Post #13





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


http://www.differ.home.pl - tutaj można zobaczyć błędy. Wydaję mi się, że coś jest nie tak z home.pl i tego się boję bo nie wiem jak inaczej mógłbym zincludować ostatnie tematy na stronę główną...

Ten post edytował paffel 26.06.2008, 11:23:12
Go to the top of the page
+Quote Post
l0ud
post 26.06.2008, 11:27:03
Post #14





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

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


Zostaw include tak jak teraz jest i w lasttopic.php zamień linię:

  1. <?php
  2. $phpbb_root_path = './';
  3. ?>


na

  1. <?php
  2. $phpbb_root_path = './forum/';
  3. ?>


--------------------
XMPP: l0ud@chrome.pl
Go to the top of the page
+Quote Post
paffel
post 26.06.2008, 11:38:17
Post #15





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Pojawiły się najnowsze tematy ale:
http://www.differ.home.pl
Go to the top of the page
+Quote Post
matx132
post 26.06.2008, 20:39:21
Post #16





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


z tego co wiem to phpbb jest specyficzne i jesli chcesz jakis plik includować on bedzie chciał też zapewne includować inne których nie znajdzie w damym katalogu:)


jak sama nazwa wskazuje

"phpBB Debug"
Go to the top of the page
+Quote Post
l0ud
post 26.06.2008, 21:33:07
Post #17





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

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


No niestety nie jest przeznaczeniem tego skryptu, aby został on gdzieś zaincludowany. Spróbuj zakomentować/usunąć tą linię:
  1. <?php
  2. $user->session_begin();
  3. ?>


edit: nie zauważyłem błędu dalej (poniżej). Występował on przed dołączeniem skryptu?

Chyba nie tędy droga, aby zmusić ten skrypt do działania w ten sposób. Spróbujmy tak:

1. Przywróć poprzednią wersję piku lasttopic.php (przed tą modyfikacją, którą poleciłem)
2. Zamiast include("./forum/lasttopic.php"); użyj tej linii:
  1. <?php
  2. readfile('http://www.differ.home.pl/forum/lasttopic.php');
  3. ?>

3. Jeżeli dalej nie będzie działało, utwórz plik php.ini o następującej treści:
Kod
allow_url_fopen=on

i wrzuć go do głównego [nadrzędnego] folderu na serwerze.

Ten post edytował l0ud 26.06.2008, 21:41:53


--------------------
XMPP: l0ud@chrome.pl
Go to the top of the page
+Quote Post
paffel
post 26.06.2008, 21:42:44
Post #18





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 30.04.2007

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


Ok zrobione:
http://www.differ.home.pl smile.gif

~l0ud - jesteś wielki smile.gif

dodałem plik php.ini i zmieniłem include na readfile.

Ten post edytował paffel 26.06.2008, 21:52:09
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 07:47