Unique Session variable per Script (not login)
Posted: Thu Sep 09, 2010 5:11 am
Hi guys,
I have a couple of pages that I'm running, one accesses local servers, one accesses remote servers, but other than that they are the same. The page refreshes automatically every 60 seconds, and loads the new information.
I recently started using $session variables to pass data across each time the page refreshes, and also to count how many times thepage has refreshed. But, when run side by side they both use the same session variable for the page counting (and maybe other info, I haven't checked that). So I might have page 1 which has refreshed 150 times, then I open page 2 for the first time, and it tells me it has refreshed 151 times.
Is there a way to set some kind of unique identifier on each page so the page count is correct?
I'm currently using:
to count the page views.
I have a couple of pages that I'm running, one accesses local servers, one accesses remote servers, but other than that they are the same. The page refreshes automatically every 60 seconds, and loads the new information.
I recently started using $session variables to pass data across each time the page refreshes, and also to count how many times thepage has refreshed. But, when run side by side they both use the same session variable for the page counting (and maybe other info, I haven't checked that). So I might have page 1 which has refreshed 150 times, then I open page 2 for the first time, and it tells me it has refreshed 151 times.
Is there a way to set some kind of unique identifier on each page so the page count is correct?
I'm currently using:
Code: Select all
session_start();
if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1;
else
$_SESSION['views'] = 1;