Computer info

Hello masters! It is necessary to write a script that, when entering the site, will write data to the ip.txt file, for example:

1* 13:55 23.11.11 Windows Xp SP3 Opera 127.0.0.1 Beeline Stavropol Russia<br/>
2* 10:16 22.11.11 Linux Mandriva Mazila 127.0.0.1 MTS Moscow Russia<br/>

Something like this should work… Every time you visit the page
Thanks in advance!


Answer 1, authority 100%

<?php
$log = "ip.txt"; //  
$ip = $_SERVER['REMOTE_ADDR']; // 
$agent = $_SERVER['HTTP_USER_AGENT']; //
$date = date("F j, Y, g:i a"); //   March 10, 2001, 5:16 pm
$fp = fopen($log, 'a'); //    (  )
fwrite($fp, $date2.$ip.$agent."\n"); // -     
fclose($fp); // 
?>

//more details (for other parameters) google the contents of the $_SERVER array, take the data from there and write it to the file. There will be questions, write here.


Answer 2

In general, to get the time on the user’s computer, you need to use not the “date”function,
and “localtime”. “Date”returns the date on the server where php is installed, and “localtime”is an array of
9 elements. More details in the manual – http://www.php.su/functions/?localtime