<? if(file_exists("counter.dat")) { $exist_file = fopen("counter.dat", "r"); $new_count = fgets($exist_file, 255); $new_count++; fclose($exist_file); $MYID = $new_count; $exist_count = fopen("counter.dat", "w"); fputs($exist_count, $new_count); fclose($exist_count); } else { $new_file = fopen("counter.dat", "w"); fputs($new_file, "1"); $MYID = 1; fclose($new_file); } echo $MYID; ?>