er0k,

the:
PHP Code:
if ($file == false)
{
 echo 
"Error: Could not create or open counter.txt";

if that is what you're referring to, works because fopen() returns a file identifier if the operation was successful, and returns false if it wasn't, so if $file == false then the file couldn't be created or opened... which means it can't be used. If $file !== false then it is a file identifier which can be used for read and write operations, depending on file mode specified in fopen().
Hope that helps, i'll explain in more detail in IRC sometime if you require.


Addendum:
technically, it would've been better if i'd used:
PHP Code:
if ($file == false)
{
die(
"Error: Could not create or open counter.txt");

as this would've ended program execution instead of trying to display the counter anyway. It wuold also be fairly easy to match digits in the count to images, say 1.png or 2.png, to give a graphical count as opposed to a text-based count.