calling a php counter from an index.html file? any ideas?
as soon as someone arrives at index.html, it calls a php file to record the page name and then increments the counter +1, no else sees the counter, just me. it's kept in it's own little txt file with the filename (in this case index.html) as the title. can anyone help me with just the calling the script from a html file?
thx,
Tyler
calling a php counter from an index.html file
Moderator: General Moderators
Unless php is parsing your html files ( i think they can do that ) then you would have to have something from the hmtl that calls a php file to load... but that would be kinda like a redirect... so either make it a index.php and put a script at the top that increments or redirect it through other pages... that's how i think it works... I could be disatrously wrong though ;
)
)
But can you do that? have the default index be a php file? i thought it HAD to be index.htm(l). So i could just have say index.php and it would make that the default page? i didn't know that...if im correct in my guessing then i learned a new trick, cool. anyway, this is how i understand what u said:
1. make an index.php that does the counter, then redirects to index.htm
i guess i could put the source code into the php file, but while complicate things?
thx a gigabyte,
Tyler
1. make an index.php that does the counter, then redirects to index.htm
i guess i could put the source code into the php file, but while complicate things?
thx a gigabyte,
Tyler
It all depends how the webserver is setup, you could actually have anything, you could set the webserver's default page to asfagagbagsafd.gadlkj if you really felt like it!
In apache this is configured by editing the DirectoryIndex setting, this is what mine looks like:
I think the items listed first have more priority, although I could be wrong!
In apache this is configured by editing the DirectoryIndex setting, this is what mine looks like:
Code: Select all
DirectoryIndex index.html index.html.var index.php<img src="counter.php?page=index.html"> in index.html then:
Code: Select all
<?
//insert counter processing code here
//return an image
$fp=@fopen("img/ok.jpg","rb");
$file_cont=fread($fp,filesize("ok.jpg"));
@fclose($fp);
echo $file_cont;
?>