My very first PHP script - i must admit i was somewhat disapointed by the flakiness of the w+ parameter, which didnt seem to work as it should (ie, how it works in Tcl). Rather than reading *from* the file
and then truncating it, it just truncated. So, I found that i had to open a read handle, close it, then open a write handle.
<?php
$rFile = fopen("count.txt","r+");
$contents = fread ($rFile, filesize("count.txt"));
$contents++;
echo("Welcome to slayer.office visitor number <b>$contents</b>.");
fclose($rFile);
$wFile = fopen("count.txt","w");
fwrite($wFile,$contents,strlen($contents));
fclose($wFile);
?>
slayer.office home