Jump to content
sharkyz

PHP Count

Recommended Posts

Posted (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 by sharkyz

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...