Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Contatore

  1. #1

    Contatore

    Salve, c'è qualcuno che potrebbe aiutarmi con questo contatore di accesso:

    <?php
    //this is our text file if you create a different
    //named file change the script below to reflect this
    include ("kounter.txt");
    $counter_file = ("kounter.txt");
    //now we open the file
    $visits = file($counter_file);
    //this increments the counter value by 1
    $visits[0]++;
    //now we will open the counter file for
    //writing "w"
    $fp = fopen($counter_file , "w");
    //put the new count value into the counter
    //file
    fputs($fp , "$visits[0]");
    //close the file
    fclose($fp);
    //display the count
    echo $visits[0];
    ?>

    Non mi da errori, ma non mi visualizza niente.CHI SA'???
    Gennaro

  2. #2
    <?php
    $file = 'utenti.txt';
    $fp = fopen( $file, 'r+' );
    settype( $num = fread( $fp, filesize( $file ) ), "float" );
    fseek($fp, 0);
    fwrite( $fp, ++$num );
    fclose( $fp );


    // il numero utenti
    echo $num;
    ?>



    NOTA il file utenti.txt deve esistere e contenere il solo carattere 0 ed avere il CHMOD impostato a 777
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  3. #3
    Grazie,
    volevo chiederle un'ultima cosa:
    ho il file kounter.php che effettua l'incremento del valore numerico presente nel file .txt e lo visualizza.
    Come posso chiamare questo file .php in modo che il valore venga visualizzato nel punto voluto.
    Grazie
    Gennaro

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.