I have an unsolved issue on my site, which is a little complicated to explain, hope it as clear enough:
I built a PHP file (count.php) that handles sessions - the file create a new session variable every time a visitor come to the site.
If the variable exists already it adds 1 to this variable - this is the page views counter:
session_start();
if(isset($_SESSION['count']))
$_SESSION['count'] = $_SESSION['count'] + 1;
else
$_SESSION['count'] = 1;
The count.php file works fine - i also duplicated it as count2.php, and when i surf from count.php to count2.php i see the page views increasing.
I wanted this function to be on my whole site so i did:
<?include 'count.php'?> on all of my pages.
And here is the problem - It seems like every page view the session info from the last page doesn't pass to the next page and i always get
$_SESSION['count'] as 1.
Any idea why it's like this?
I tried doing this:
<script src='count.php'></script>
On my pages - this works fine but it doesn't help me with what i want. I want to be able to do different stuff on the php level on my site's pages with the session variables. So i need to get the value of the session variables on my php code and not as an external file.
Hope someone can help me...