I have a php site I have an include line called
include 'Cookie.php';
In this Cookie.php file I have these codes.
<?php
$conn = mysql_connect("$db", "$user", "$pass");
mysql_select_db("$db");
//---------------------------------------------------------------------------------------
//COOKIE
//---------------------------------------------------------------------------------------
$cookiename = 'TourCounter';
if( isset( $_COOKIE[$cookiename] ) ){$user_id = $_COOKIE[$cookiename];}
else {
mysql_query ("INSERT INTO CountUser (Dato) VALUES (now())");
$user_id = mysql_insert_id();
setcookie( $cookiename, $user_id, time()+315360000);
;}?>
This will set a cookie on the computer when people enters the site for the first time, and update my database.
Now I can see how many new computers that see my site each day, and it works fine.
BUT, now I have another site where all the pages are .shtml sites, and I have not been using any php scripting at all, though it is uploadet on a server where I can use php.
But now I can't include the file, cause if I write
<!--#include file="Cookie.php"-->
it include some php codes, but since the site is called .shtml it offcause can't execute the php script.
But isn't there a way to do this anyway.
Maybe by some javascript that executes the Cookie.php fil or something. ??
The site has a lot a pages, and I would rather not rename them all to .php and the shtml include to php include on all the pages.
I have a menu that is included on all the pages, so if it could be executed in the menu file, I will count all hits, nomatter what site people enters first.
Hope someone have a good idea.
best
Michael