Najnowsze wypowiedzi

Napisane przez użytkowników:

[Praca oferowana / wspó³praca] Programista C/C++
Dla naszego klienta du¿ej miêdzynarodowej firmy poszukujemy osób na stanowisko Programista/ Team Leader Lokalizacja Warszawa Wymagane: -roczne do¶wiadczenie C/C++ -znajomo¶æ jêzyka...
[Praca oferowana / wspó³praca] Programista RPG
Dla naszego klienta du¿ej instytucji finansowej poszukujemy osoby na stanowisko Programista Wymagane do¶wiadczenie w programowaniu RPG. Lokalizacja Poznañ Osoby zainteresowane proszê o...
[Praca oferowana / wspó³praca] Software Implementation Manager Java
Witam serdecznie Dla naszego klienta firmy konsultingowej poszukujemy osob na stanowisko Software Implementation Manager Lokalizacja: Warszawa Wymagania: - 2 lata do¶wiadczenia w...
[Praca oferowana / wspó³praca] Programista PL/SQL Oracle
Dla naszego klienta dostawcy systemow ERP, poszukujemy osob na stanowiska Software Developera. Lokalizacja: Poznan, Gdansk Wymagania doswiadczenie w programowaniu w PL/SQL, Java znajomosc...
[VBA i OOoB] [Excel] Zliczanie konkretnej warto¶ci z pliku textowego
Cze¶æ Wszystkim, mam taki problem; potrzebuje do excel'a za pomoc± makra zliczyæ ilo¶æ wierszy z pliku tekstowego dla których w pewnej kolumnie wystepuje jaka¶ warto¶æ. (plik textowy rozdzialony...

Nauka PHP

Kurs w celu przybliżenia języka jakim jest php.



User Submitted Data

Rozdział 30. User Submitted Data

The greatest weakness in many PHP programs is not inherent in the language itself, but merely an issue of code not being written with security in mind. For this reason, you should always take the time to consider the implications of a given piece of code, to ascertain the possible damage if an unexpected variable is submitted to it.

Przykład 30-1. Dangerous Variable Usage

<?php
// remove a file from the user's home directory... or maybe
// somebody else's?
unlink ($evil_var);

// Write logging of their access... or maybe an /etc/passwd entry?
fwrite ($fp, $evil_var);

// Execute something trivial.. or rm -rf *?
system ($evil_var);
exec ($evil_var);

?>
You should always carefully examine your code to make sure that any variables being submitted from a web browser are being properly checked, and ask yourself the following questions:

  • Will this script only affect the intended files?

  • Can unusual or undesirable data be acted upon?

  • Can this script be used in unintended ways?

  • Can this be used in conjunction with other scripts in a negative manner?

  • Will any transactions be adequately logged?

By adequately asking these questions while writing the script, rather than later, you prevent an unfortunate re-write when you need to increase your security. By starting out with this mindset, you won't guarantee the security of your system, but you can help improve it.

You may also want to consider turning off register_globals, magic_quotes, or other convenience settings which may confuse you as to the validity, source, or value of a given variable. Working with PHP in error_reporting(E_ALL) mode can also help warn you about variables being used before they are checked or initialized (so you can prevent unusual data from being operated upon).

Ciekawe informacje

Najciekawsze informacje znalezione w sieci

Obsługa wielowątkowości, jak to wykonać, przykład gdy wątki próbują robić coś równocześnie (jak temu zapobiec, lub jak to obsłużyć) np w przypadku obiektu klasy RECORDSET jeden cos tam jeszcze myka pobiera, się wcina i przed pobraniem następuje zamkniecie (close()) obiektu recordset.