Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to 'print' counter result into html page?

Status
Not open for further replies.

chinan

Technical User
Oct 23, 2004
16
CA
I downed a "counter.php" file and a "counter.dat" file.
when I open the it works fine. I don't know how to embed/print the counted result (number) into my mage index.htm.

following is the php file codes:

<?php
$counterFile="counter.dat";
$counterData=file($counterFile);
$sign=False;
for($i=0;$i<=count($counterData)-1;$i++)
{
$varArray=explode("|",$counterData[$i]);
if ($varArray[0]==$PATH_INFO)
{
$varArray[1]++;
print($varArray[1]);
$counterData[$i]=implode("|", $varArray);
$sign=True;
break;
}
}

$data=implode("",$counterData);
$fp=fopen($counterFile,"w");
fputs($fp,$data);

if (!$sign)
{fputs($fp,"\n$PATH_INFO"."|"."1"."|");
print("1");}
fclose($fp);
?>

I copied the codes above to the index.htm page code between <body>... </body> but it does not work.

Could anyone tell me how to make it works? I already spend 6 hours on this tiny function. I appreciate for your help.

Thanks.
 
As this is a PHP question poerhaps you should ask it in the PHP forum for a better response.

PHP Forum: Forum434.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top