I'm having problems getting a PHP Page Visitor Counter working.

My website has multiple directories due to the large number of pages involved.

http://www.ronkskitchen.com is the Main directory where the main file is named "index.htm".

Underneath the main directory, there are 30+ sub-directories:

ronkskitchen.com/appetizers/index.htm
ronkskitchen.com/barbecues/index.htm
ronkskitchen.com/hungarian/index.htm
ronkskitchen.com/seafoods/index.htm
etc.

Each sub-directory has a variable number of unique pages attached.

In each of the unique index.htm files I have included the following PHP code in the HTML Code Head section under Web Properties (Page Tab):

<?php
session_start();
$counter_name = "hungarian.txt";

// Check to see if a text file actually exists.
//If not create one and initialize it to a zero.
if (!file_exists($counter_name)) {
$f = fopen($counter_name, "w");
fwrite($f,"0");
fclose($f);
}
// Read the current value stored in our counter file
$f = fopen($counter_name,"r");
$counterVal = fread($f, filesize($counter_name));
fclose($f);

// Has a previous visitor already been counted in this session?
// If not, increase counter value by one
if(!isset($_SESSION['hasVisited'])){
$_SESSION['hasVisited']="yes";
$counterVal++;
$f = fopen($counter_name, "w");
fwrite($f, $counterVal);
fclose($f);
}

$counterVal = str_pad($counterVal, 5, "0", STR_PAD_LEFT);
$chars = preg_split('//', $counterVal);
$im = imagecreatefrompng("canvas.png");

$src1 = imagecreatefrompng("$chars[1].png");
$src2 = imagecreatefrompng("$chars[2].png");
$src3 = imagecreatefrompng("$chars[3].png");
$src4 = imagecreatefrompng("$chars[4].png");
$src5 = imagecreatefrompng("$chars[5].png");

imagecopymerge($im, $src1, 0, 0, 0, 0, 56, 75, 100);
imagecopymerge($im, $src2, 60, 0, 0, 0, 56, 75, 100);
imagecopymerge($im, $src3, 120, 0, 0, 0, 56, 75, 100);
imagecopymerge($im, $src4, 180, 0, 0, 0, 56, 75, 100);
imagecopymerge($im, $src5, 240, 0, 0, 0, 56, 75, 100);

// Output and free from memory
header('Content-Type: image/png');
echo imagepng($im);
imagedestroy($im);
?>

The "directoryname.txt" files do not exist now, but the code doesn't seem to create one and initialize it to zero. Either that, or it actually is creating the file somewhere in a directory / sub-directory located where I am unable to find it. All I really want are plain black numbers (0 thru 9) on a white background.

In each different index.htm file, I have also included the following PHP code in the HTML Code Body section under Web Properties (Page Tab) to display the visitor counter value:

<img alt="VISITS" src="hungarian.php" />

This code works, but doesn't display a value (I assume it's only because the hungarian.txt file doesn't exist yet).

This "image VISITS" is displayed centered at the very top of the index.htm page.

How can I move the display image to the bottom of that page?

Thanks
Ron