Hello all, I am trying to get through PHP Sessions, and learn how to get them working.
As you might guess, since I am posting here I am not having much luck.
Here is my problem. I am attempting to use sessions both through cookies and through using the trans sid.
The server that I am using is configured properly, because it also has my phpbb running on it, where it appends the url properly. I think the problem is with my code.
So, here is the code for my basic page:
Code:
<?php
session_start();
if (!isset($SESSION['count'])) {
$SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?>
Hello visitor, you have seen this page <?php print $count; ?> times.<p>
<?php print SID ?>
Now, I have noticed that the page does indeed keep count of how many times I view the page. If I refresh, the count increases. Dandy. However, the page will only display my SID once. (The first time).
To better clarify, if I added a link to the page, it will append the url with my PHPSESSID, but only the one time. After I click on the link, the Session ID will no longer be added.
In case anyone is wondering, I do have the --enable-trans-id compiled on the server, as well as the session use cookies setting, and the other session settings.
I don't think it is a problem with my server, since I run phpBB without problem and it uses session control (although through a mysql db).
I have a feeling it is my poor code, but don't know for sure. Version of PHP is 4.2.3.
Any ideas?