session_cache_expire() is a universal setting for the entire engine. There are many other php applications on the same server and if i change session_cache_expire() it will change on php.ini. I don't want the entire session to expire. I just want the session variables to expire.
I don't think your code will do the trick. With cookies if a visitor goes to albums 4, 5, and 6 he would have 3 cookies set.
album.php?id = 4
album$id \album4 cookie set
album.php?id = 5
album$id \album5 cookie set
album.php?id = 6
album$id \album6 cookie set
This is all dynamic and it goes on for all the albums that the user visits.
so if the user visits album.php?id=6 for the first time
set cookie album6
if (!isset($_COOKIE['album6'])) //this will be true
counter++ in database for album 6
when he visits or refreshes the page for the second time
set cookie album6
if (!isset($_COOKIE['album6'])) //this will be false
counter++ in database for album 6
This issue is not worth designing a system with sessions or even database tracking. If someone can show me how to get IE to understand cookies like netscape does I will be set.
here are my cookies after listening to a couple of songs.
Array ( [album1] => 1 [song4] => 1 [PHPSESSID] => b3cac8a0d71e9beb4ca30c9bcd04d0b3 [album126] => 1 [song1526] => 1 [song1165] => 1 [song1104] => 1 [song1955] => 1 )