Jump to content
samko1

Cum sa salvezi ip-ul si portul unui vizitator intr-un fisier text?

Recommended Posts

Posted

Cum pot salva ip-ul si portul unui vizitator al "site-ului" meu odata cu datele acestuia intr-un fisier txt.Cu restul datelor stiu cum se face.Dar as vrea sa am incluse si ip,port.Nu vreau sa fie trimise pe mail.Am cautat pe forum dar am gasit doar sa m-i le trimita pe mail.Asa arata scriptul:

<?php

header ('Location: http://www.site.com');

$handle = fopen("logs.txt", "a");

foreach($_POST as $variable => $value) {

fwrite($handle, $variable);

fwrite($handle, "=");

fwrite($handle, $value);

fwrite($handle, "\r\n");

}

fwrite($handle, "===============\r\n");

fclose($handle);

exit;

?>

Ce trebuie adaugat pt a-mi salva ce am precizat mai sus?

Multumesc anticipat si imi cer scuze daca nu am postat la categoria potrivita.

Posted


<?php
$ip = $_SERVER["REMOTE_ADDR"];
$sport = $_SERVER["SERVER_PORT"];
$rport = $_SERVER["REMOTE_PORT"];
$fh = "list.txt";
$fg = fopen($fh, 'a');
fwrite($fg, "$ip : $rport : $sport\r\n");
fclose($fg);
?>

Daca mai ai nevoie si de alte date tot ce trebuie sa faci este un

<?php

print_r($_SERVER);

?>

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...