Version: 1
Type: Function
Category: Other
License: GNU General Public License
Description: Raw but functional, reads in a text file, increments, writes it out and displays the output
// The file must have global write permisions on it (chmod 666 filename) // note absolute path is specified so that it can be used in subdirs also $counterval = 0; $fp = fopen( "/<absolute_path_here>/page_counter.txt","r"); $counterval = fread($fp, 26 ); fclose( $fp ); $counterval = (integer)$counterval + 1; $fp = fopen( "/<absolute_path_here>/page_counter.txt","w+"); fwrite( $fp, $counterval, 26); fclose( $fp ); echo "$counterval";