Xander Posted April 22, 2011 Report Posted April 22, 2011 (edited) Este doar un poc dar oricum fata de[RST] Autentificare pe baza de "amprenta"care nu poate fi folosit IRL... metoda asta (salvezi hash-ul fisierului doar in db)este mult mai eficienta si ca timp de executie si ca memorie+ merge cu orice tip de fisier(poze,arhive,virusi, etc...)<?phpsession_start();?><form method="post" enctype="multipart/form-data"><input type="file" name="upl" /><input type="submit" name="submit" value="Verifica" /></form><?phpif(isset($_POST['submit'])){ $data = file_get_contents($_FILES['upl']['tmp_name']); $hash = hash('sha512', $data); unset($_FILES['upl']['tmp_name']); if(!isset($_SESSION['ok']) && $data != "") { $good_hash = trim(file_get_contents(".hthash")); if(!isset($_FILES['upl']) || $_FILES['upl']['error']) die("Error please choose a file!"); if($hash != $good_hash) die("Invalid!"); $_SESSION['ok'] = 1; } else { file_put_contents(".hthash" , $hash); echo "Hash updated, session destroyed!<br />"; unset($_SESSION['ok']); die(); } echo "Welcome home, upload a file to change the signature.";}?>p.s. daca vreti sa testati scriptul asa cum este trebuie sa aveti drept de scriere pe fisierul .hthash Edited April 22, 2011 by Xander Quote