je cherche à faire un compteur qui compte qd le visiteur ne vient pa deux fdois de suite sur le site :
<?
$f1=fopen("ip.txt","w");
fputs($f1, $REMOTE_ADDR);
fputs($f1, "\n");
?>
<?
$f1=fopen("ip.txt","r");
while(!feof($f1))
{
$max=fgets($f1,1);
$i=0;
while($max!='\n')
{
$tab[$i]=$max;
$max=fgets($f1,1);
$i++;
}
}
$tab[i]='\0';
if($tab!=$REMOTE_ADDR)
{
$f2=fopen("cpt.txt","r");
while(!feof($f2))
{
$x=fgets($f2,1);
fclose($f2);
$x += 1;
$f2=fopen("cpt.txt","w");
fputs($f2,$x);
fclose($f2);
}
fclose($f1);
?>
en c au départ ça donnait
f1=fopen("ip.txt","wt");
fprintf(f1, "%s\n", REMOTE_ADDR);
f1=fopen("ip.txt","rt");
while(fscanf(f1,"%c",&max))
{
i=0;
while(max!='\n')
{
tab[i]=max;
fscanf(f1,"%c",&max);
i++;
}
}
tab[i]='\0';
if(tab!=REMOTE_ADDR)
{
f2=fopen("cpt.txt","rt");
while(fscanf(f2,"%d",&x)!=EOF);
fclose(f2);
x += 1;
f2=fopen("cpt.txt","wt");
fprintf(f2,"%d ",x);
fclose(f2);
}
fclose(f1);
puis j'ai essayé d'y traduire en php mais ce n'est pas juste et je ne suis pas sur qu'il réalise ce que je voulais.
aides moi à le corriger.
mci
kidpigeyre