Voila :
$fp = fopen("compteur.txt","r");
$nbvisites = fgets($fp,100);
print ("Avant : $nbvisites");
$nbvisites++;
print ("Apres : $nbvisites");
fclose($fp);
$fp = fopen("compteur.txt","w");
fputs($fp,$nbvisites);
fclose($fp);
$fp = fopen("compteur.txt","r");
$nb= fgets($fp,100);
fclose($fp);
print ("Compteur : $nb");
?>
Voila, ca devrait marcher ! (g enlever les positions)
Bye
\* --
Seb -- */
-------------------------------
Réponse au message :
-------------------------------
> je te conseille de lire ce tuto
>
> http://www.phpcs.com/article.aspx?Val=92
>
> John Hicksman

>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > je commence le php que depuis deux jours et la jécris un truc et boom erreur et imossible de savoir ou :
> >
> > <html>
> > <head>
> > <title>compteur</title>
> > </head>
> > <body>
> > <?
> > $fp = fopen("compteur.txt","a+");
> >
> >
> > $nbvisites = fgets($fp,100);
> >
> > print ("Avant : $nbvisites");
> >
> > fseek( $fp, 0 );
> >
> > $pdp=ftell($fp);
> >
> > print ("Position : $pdp");
> >
> > $nbvisites++;
> >
> > print ("Apres : $nbvisites");
> >
> > fputs($fp,$nbvisites);
> >
> > $pdp=ftell($fp);
> >
> > print ("Position2 : $pdp");
> >
> > fclose($fp);
> >
> > $fp = fopen("compteur.txt","r");
> >
> > $nb= fgets($fp,100);
> >
> > fclose($fp);
> >
> > print ("Compteur : $nb");
> >
> > ?>
> > </body>
> > </html>
> > > > normalement sa devrait affiché dans compteur.txt le nbr de passages mais non.
> > \->Bye Defkrie !?!
>