aktell
11-02-2006, 05:30 AM
Hi there,
I'm very green again, three years ago I loved working with PhP and now the same as before I have to ask questions.
I just started a new web site again and wanted to use my so beloved PhP code. I can view web pages with php code but if I want to use code for a hit counter I get errors !!! I have used this code snippets hundrets of times but this time no luck.
My question is here really is if anybody could tell me if it is these days enough to just have the php code as below OR do I have to include anything else in a wepage ( I always had to use the following on the very top in my old .php pages) #!/usr/local/bin/php
I useed this code for the counter"
<?php
$counter = "counter_intro.txt";
function displayCounter($counter)
{
$fp = fopen("$counter", "r");
$num = fread( $fp, 100);
$fpsoma = ($num + 1);
fclose($fp);
$fa = fopen("$counter", "w");
fwrite( $fa, $fpsoma, 100);
fclose($fa);
echo "<font color=#00ff00><center>$fpsoma</center></font>";
}
displayCounter($counter);
?>
Thanks in advance for any help. aktell
I'm very green again, three years ago I loved working with PhP and now the same as before I have to ask questions.
I just started a new web site again and wanted to use my so beloved PhP code. I can view web pages with php code but if I want to use code for a hit counter I get errors !!! I have used this code snippets hundrets of times but this time no luck.
My question is here really is if anybody could tell me if it is these days enough to just have the php code as below OR do I have to include anything else in a wepage ( I always had to use the following on the very top in my old .php pages) #!/usr/local/bin/php
I useed this code for the counter"
<?php
$counter = "counter_intro.txt";
function displayCounter($counter)
{
$fp = fopen("$counter", "r");
$num = fread( $fp, 100);
$fpsoma = ($num + 1);
fclose($fp);
$fa = fopen("$counter", "w");
fwrite( $fa, $fpsoma, 100);
fclose($fa);
echo "<font color=#00ff00><center>$fpsoma</center></font>";
}
displayCounter($counter);
?>
Thanks in advance for any help. aktell