Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] czy taki include jest bezpieczny?
maribt
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 7.04.2010

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


Witam

w php nie jestem nawet początkujący ale chciałbym sobie ułatwić trochę pracę na moich stronach:) Otóż mam kod z systemu wymiany linków i powiedzmy 100 stron na różnych domenach i kilku hostingach i chciałem się zabezpieczyć na wypadek bana lub innych ewentualności w których będę chciał zmienić SWL więc postanowiłem zrobić coś takiego:

  1. <?php
  2.  
  3. include ('http://www.jakasstrona.pl/plik.inc');
  4. ?>


Czy takie zastosowanie funkcji include jest bezpieczne?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
potreb
post
Post #2





Grupa: Zarejestrowani
Postów: 1 568
Pomógł: 192
Dołączył: 7.03.2005
Skąd: Warszawa

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


Jak zadziała to tak.

If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.


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

Go to the top of the page
+Quote Post
botnaizi
post
Post #3





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 8.12.2009

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


Jeśli includujesz plik ze swojego serwera to jest bezpieczne. Jeśli należy do kogoś innego to ktoś może dać skrypt w tym pliku i go wywołać, i dzięki niemu mieć dostęp do Twoich danych.
Go to the top of the page
+Quote Post
luck
post
Post #4





Grupa: Zarejestrowani
Postów: 317
Pomógł: 58
Dołączył: 6.11.2005

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


A żeby było to jeszcze bezpieczniejsze, to - o ile jest to Twój serwer - zamiast "plik.inc" nazywaj pliki np. "plik.inc.php" (chodzi o rozszerzenie). Dzięki temu nikt Ci nie podejrzy kodu, którego być może nie powinien widzieć.


--------------------
Go to the top of the page
+Quote Post
maribt
post
Post #5





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 7.04.2010

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


plik oczywiście bedzie na moim serwerze.

dzięki:)
Go to the top of the page
+Quote Post
vokiel
post
Post #6





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Jeśli ze swojego serwera to nie podawaj ścieżki z http, tylko według struktury plików na dysku


--------------------
Go to the top of the page
+Quote Post
maribt
post
Post #7





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 7.04.2010

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


ale strony będą na różnych serwerach
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 Aktualny czas: 19.08.2025 - 20:36