sharkyz Posted January 1, 2012 Report Share Posted January 1, 2012 (edited) Hi,Am un cod php care pastreaza ora si adresa php a unui vizitator si introduce datele intr-un fisier .php...Cod-ul este:<?php $ipaddress = $_SERVER['REMOTE_ADDR']; $date = date ("H:i:s dS M"); $message = "<?php /* $date <-|-> $ipaddress * /?>\n";$myip = "<?php /* $date <-|-> MYIP /* ?>\n";$File = "ipsave.php";$Open = fopen($File, "a+");if ($ipadress = "255.255.255.255") {fwrite($Open, "$myip");} else {fwrite($Open,"$message"); fclose ($Open); } ?>I.Cea ce vreau eu sa fac este sa pun in ordine numerica..de exemplu 1.<?php /* $date <-|-> x.x.x.x /* ?>2.<?php /* $date <-|-> x.x.x.x /* ?>3.<?php /* $date <-|-> x.x.x.x /* ?>si tot asa..II.Si as vrea sa stiu cum as putea crypta fisierul ipsave.php cu o cheie unica!Am gasit codul de mai jos dar nu stiu cum sa il modific incat sa imi crypteze doar fisierul ipsave.php din acelasi fisier..<?php function encryptFile() { global $cryptastic; $pass = PGPPASS; $salt = PGPSALT; $key = $cryptastic->pbkdf2($pass, $salt, 1000, 32) or die("Failed to generate secret key."); if ($handle = opendir(PATH.'/ftpd')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $newfile = PATH.'/encrypted/'.$file.'.txt'; $msg = file_get_contents(PATH.'/ftpd/'.$file); $encrypted = $cryptastic->encrypt($msg, $key) or die("Failed to complete encryption."); $nfile = fopen($newfile, 'w'); fwrite($nfile, $encrypted); fclose($nfile); unlink(PATH.'/ftpd/'.$file); } } closedir($handle); } ?>Multumesc anticipat! Edited January 1, 2012 by sharkyz Quote Link to comment Share on other sites More sharing options...
Robert1995 Posted January 1, 2012 Report Share Posted January 1, 2012 (edited) tu citesti tot directoriul mergi pe path absolut catre fisier e evidenta greseala care ai facut-o . ------ Edited Edited January 1, 2012 by Robert1995 Quote Link to comment Share on other sites More sharing options...