1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <?
// affichage d'une date au fromat hour-min-sec-aaaa-mm-jj --> lundi 1 janvier 2004 19:25 :58 sec
function dateLog($maDate, $WeekDayOn=1, $YearOn=1)
{
$Mois = array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
$Jours = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
$DF=explode('-',$maDate);
$leJour=getdate(mktime($DF[0],$DF[1],$DF[2],$DF[4],$DF[5],$DF[3]));
$maDate=$DF[5]." ".$Mois[$DF[4]-1];
if($WeekDayOn){$maDate=$Jours[$leJour["wday"]]." ".$maDate;}
if($YearOn){$maDate.=" ".$DF[3];}
return $maDate." ".$DF[0].":".$DF[1].":".$DF[2]." sec";
}
$dateVisite=dateLog(date("H-i-s-Y-m-d"));
$source="Inconnue";
if(isset($_SERVER['HTTP_REFERER']))
$source=$_SERVER['HTTP_REFERER'];
$Langue = explode(",",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
$Langue = strtoupper(substr(chop($Langue[0]),0,2));
$ip_client=$_SERVER["REMOTE_ADDR"];
$Nav=$_SERVER["HTTP_USER_AGENT"];
if (ereg("MSIE", $_SERVER["HTTP_USER_AGENT"])) {
$Nav="Internet explorer";
} else if (ereg("^Mozilla/", $_SERVER["HTTP_USER_AGENT"])) {
$Nav="Netscape navigator";
} else if (ereg("^Opera/", $_SERVER["HTTP_USER_AGENT"])) {
$Nav="Opéra";
}
$stat="";
$stat.="***********************************************************************************************\r\n";
$stat.=$dateVisite."\r\n";
$stat.="[LANG = ".$Langue."] - [IP = ".$ip_client."]\r\n\r\n";
$stat.="# Systeme d'exploitation : ".$_POST['platforme']."\r\n\r\n";
$stat.="# Navigateur : ".$_SERVER["HTTP_USER_AGENT"]."\r\n\r\n";
$stat.="# Moteur de Navigateur : ".$Nav."\r\n\r\n";
$stat.="# Plugins installés : ".$_POST['plugins']."\r\n\r\n";
$stat.="# Page source : ".$source."\r\n\r\n";
$stat.="***********************************************************************************************\r\n";
//echo $stat;
if (isset($_POST['platforme']) && $_POST['platforme']!="")
{
$file = fopen("log.txt","a");
fputs($file,$stat."\r\n");
fclose($file);
}
?> |
Partager