par
yann18 » 29 mai 2014, 23:02
il y a pas mal d'erreurs dans ton code notamment sur la fonction fputs dont la signature est:
int fputs ( resource $handle , string $string [, int $length ] )
en réécrivant ton code:
<?php
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip_address = $_SERVER['REMOTE_ADDR'];
}
$inF = fopen("./ip.txt", "a" ); // ouvre le fichier ip.ini en mode append
//fputs($inF, $ip_address."\n"); // récupère l'ip de l'utilisateur
fputs($inF, date('D d M Y H:i:s',time()).','. $ip_address."\n");
fputs($inF,"\n");
fclose($inF);
?>
il y a pas mal d'erreurs dans ton code notamment sur la fonction fputs dont la signature est:
[php]
int fputs ( resource $handle , string $string [, int $length ] )
[/php]
en réécrivant ton code:
[php]
<?php
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip_address = $_SERVER['REMOTE_ADDR'];
}
$inF = fopen("./ip.txt", "a" ); // ouvre le fichier ip.ini en mode append
//fputs($inF, $ip_address."\n"); // récupère l'ip de l'utilisateur
fputs($inF, date('D d M Y H:i:s',time()).','. $ip_address."\n");
fputs($inF,"\n");
fclose($inF);
?>
[/php]