Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z funkcją include
siankotm
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 2.05.2009

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


Witam,

widziałem, że są już tematy o podobnej nazwie, ale nie znalazłem tam odpowiedzi na swoje pytanie.
Mianowicie robię stronkę opartą na DIV'ach i w jednym z nich umieściłem uwarunkowanie załadowania konkretnych plików, niestety pojawia się komunikat o błędzie.

Oto fragment kodu index.php:
CODE

<div id="prawa">

<div id="prawa_tresc">

<?php

$adres = $_SERVER[REQUEST_URI];
$etap1 = '/index.php?etap=1';
$etap2 = '/index.php?etap=2';
$etap3 = '/index.php?etap=3';
$etap4 = '/index.php?etap=4';
$etap5 = '/index.php?etap=5';


if($adres == $etap1)
{
include '/pliki/prawa1.php';
}
elseif($adres == $etap2)
{
include '/pliki/prawa2.php';
}
elseif($adres == $etap3)
{
include '/pliki/prawa3.php';
}
elseif($adres == $etap4)
{
include '/pliki/prawa4.php';
}
elseif($adres == $etap5)
{
include '/pliki/prawa5.php';
}
else
{
include '/pliki/prawa1.php';
}

?>

</div>

</div>



Przejrzałem już mnóstwo różnych kursów, postów na forach etc., ale i tak nie mogę dostrzec błędu.

Proszę o pomoc. Co mogłem zrobić źle?

Pozdrawiam (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
siankotm
post
Post #2





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 2.05.2009

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


Treść błedu:
--------------------

Warning
: main() [function.main]: open_basedir restriction in effect. File(/pliki/prawa1.php) is not within the allowed path(s): (/var/www/sites:/var/www/tmp:/var/www/advertisements/:/var/www/cadvertisements/) in /var/www/sites/yoyo.pl/2/l/2loteam/index.php on line 82

Warning: main(/pliki/prawa1.php) [function.main]: failed to open stream: Operation not permitted in /var/www/sites/yoyo.pl/2/l/2loteam/index.php on line 82

Warning: main() [function.include]: Failed opening '/pliki/prawa1.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/sites/yoyo.pl/2/l/2loteam/index.php on line 82

--------------------

Dodałem apostrofy, ale to nie pomogło. Osobiście nie rozumiem tego co jest napisane w powyższym komunikacie, ale mam niemalże pewność, że chodzi o samą funkcję "include", ponieważ próbnie zastosowałem też funkcję "echo", która w tym samym miejscu działa bez zarzutu. (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

Próbowałem też zastosować 'switch' , niestety również błędy (takie same jak wyżej z tym, że wartości "on line" się zmieniły na 60).
Kod, który zastosowałem z ów funkcją:
CODE

<?php

$adres = $_SERVER['REQUEST_URI'];
$etap1 = '/index.php?etap=1';
$etap2 = '/index.php?etap=2';
$etap3 = '/index.php?etap=3';
$etap4 = '/index.php?etap=4';
$etap5 = '/index.php?etap=5';

switch ($adres) {
default:
case $etap1:
include '/pliki/prawa1.php';
break;

case $etap2:
include '/pliki/prawa1.php';
break;

case $etap3:
include '/pliki/prawa1.php';
break;

case $etap4:
include '/pliki/prawa1.php';
break;
}

?>


Dziękuję za dotychczasową pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 11.10.2025 - 10:13