Hi i would like to write in a file every access to a web page...the output look like this
Mercredi 09 Juin 2012 IP=127.0.0.1 Date=2012-05-09 Heure=10:27:48 Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1130.1 Safari/536.11
Mercredi 09 Juin 2012 IP=127.0.0.1 Date=2012-05-09 Heure=10:29:44 Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1130.1 Safari/536.11
and so on....
Instead i would like that the output looks like
Mercredi 09 Mai 2012
IP=127.0.0.1 Date=2012-05-09 Heure=10:29:48 Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1130.1 Safari/536.11
IP=127.0.0.1 Date=2012-05-09 Heure=10:56:44 Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1130.1 Safari/536.11
Jeudi 10 Mai 2012
IP=127.0.0.1 Date=2012-05-09 Heure=10:56:44 Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1130.1 Safari/536.11
and so on...
As you could see i would like that the output or the access would be seperated by the date of the day...and not written everytime on the line
For now all i've got is this error
Parse error: syntax error, unexpected ')' in line 10
First is ther a a way to do that? Could you give me some hints
<?php
setlocale (LC_TIME, 'fr-FR');
$Jour = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi","Samedi");
$Mois = array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
$f = fopen("ipintra.html", "a+");
$old_datefr = '';
while()
$datefr = $Jour[date("w")]." ".date("d")." ".$Mois[date("n")]." ".date("Y");
if ($old_datefr != $datefr) {
fwrite($f, $datefr . "\n");
$old_datefr = $datefr;
}
$log = ' <span style="color: #ff0000">IP=</span>' . $_SERVER['REMOTE_ADDR'] . ' <span style="color: #ff0000">Date=</span>';
$log .= date('Y-m-d');
$log .= ' <span style="color: #ff0000">Heure=</span>' . date('H:i:s');
$log .= ' <span style="color: #ff0000">Agent=</span>' . $_SERVER['HTTP_USER_AGENT'] . "\n";
fwrite($f, $log);
fwrite($f, "<br /><br />");
}
fclose($f);
?>
thanks