Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [funkcja] Check MD5 File Content, Zawartość pliku w MD5
entereczek
post
Post #1





Grupa: Zarejestrowani
Postów: 17
Pomógł: 3
Dołączył: 1.05.2010
Skąd: Fajne

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


Pozwala pobrać zawartość dowolnego pliku i zaszyfrować tą zawartość w MD5.

Wersja funkcji: 1.0
Autor: Polaczek (entereczek)

Wymagania:
  • PHP 4.0.0 (lub lepszy)
  • Serwer FTP i parę KB wolnego miejsca worriedsmiley.gif


Funkcja:

  1. /**
  2.  * string md5FileContent ( string $filename )
  3.  */
  4. function md5FileContent($filename) {
  5. if(file_exists($filename)) {
  6. $OpenFile = fopen($filename, 'rb');
  7. $FileContent = fread($OpenFile, filesize($filename));
  8. fclose($filename);
  9. return md5($FileContent);
  10. } else {
  11. die('Taki plik nie istnieje! Sprawdź ścieżkę pliku i jego nazwę.');
  12. }
  13. }


Przykład użycia:

  1. $md5hash['index.php'] = md5FileContent('index.php');
  2. $md5hash['global.php'] = md5FileContent('global.php');




--------------------
Polaczek
Go to the top of the page
+Quote Post

Posty w temacie


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: 21.08.2025 - 22:36