maribt
16.04.2010, 19:22:21
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:
<?php
include ('http://www.jakasstrona.pl/plik.inc');
?>
Czy takie zastosowanie funkcji include jest bezpieczne?
potreb
16.04.2010, 19:42:41
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.
botnaizi
16.04.2010, 19:45:16
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.
luck
16.04.2010, 19:48:27
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ć.
maribt
16.04.2010, 19:55:57
plik oczywiście bedzie na moim serwerze.
dzięki:)
vokiel
16.04.2010, 20:25:05
Jeśli ze swojego serwera to nie podawaj ścieżki z http, tylko według struktury plików na dysku
maribt
16.04.2010, 21:45:47
ale strony będą na różnych serwerach
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę
kliknij tutaj.