I am using this php to write to a text file to show me who has logged in and when:
<?php
$time = $_SERVER['REQUEST_TIME'];
$myusername = $_POST['myusername'];
$data = "$REQUEST_TIME\n";
$data = "$myusername\n";
//open the file and choose the mode
$fh = fopen("logs/login.txt", "a") ;
fwrite($fh, $data);
fwrite($fh, $time);
fclose($fh);
?>
The result I get in my text file is:
paul
1315919200melody
1315919221tracy&graham
1315919232ed&hannah
1315919251
I would feel more successful if the name of the user were to appear on the next line down but I can live with that but I can't make head nor tale of the date. I should apparently use:
date ()
I want it to say:
paul
13:59
13/09/2011
next user
14:00
13/09/2011 and so on
I feel I have done very well to even get that far really and wouldn't have been able to yesterday. I am frustrated to have reached the extent of my current understanding.
I've been told these are unix timestamps but I have no idea how to get the date() function into this.
If anyone can tell me where I'm going wrong, that would be great.
I hope the php isn't too far off, and you can "read between the lines" as it were to see what I'm trying to do.
Paul