Far Cry Posted October 13, 2011 Share Posted October 13, 2011 How can I track session requests, so I can, after a certain number of requests (let's say ten because it's physcologically pleasing), have the id regenerated? Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 13, 2011 Share Posted October 13, 2011 Create another session which consist of the number time it is being called. <?php session_start(); $_SESSION['sviewed']++; ?> Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279030 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 13, 2011 Share Posted October 13, 2011 this is how you use the code. sviewed means how many times the session is being used. <?php session_start(); if(isset($_SESSION['sviewed']) && $_SESSION['sviewed'] < 11) { $_SESSION['sviewed']++; } else { $_SESSION['sviewed'] = 0; // place the code where the session regenerates. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279031 Share on other sites More sharing options...
titan21 Posted October 13, 2011 Share Posted October 13, 2011 not a lot of info to go on but set a session variable - call it "count" and increment it every time you access the session, then check to see if it is equal to 10? session_start(); if(isset($_SESSION['count'])) { $count = $_SESSION['count']; $count++; $_SESSION['count'] = $count; } else { $_SESSION['count'] = 0; } session_write_close(); Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279032 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 13, 2011 Share Posted October 13, 2011 not a lot of info to go on but set a session variable - call it "count" and increment it every time you access the session, then check to see if it is equal to 10? session_start(); if(isset($_SESSION['count'])) { $count = $_SESSION['count']; $count++; $_SESSION['count'] = $count; } else { $_SESSION['count'] = 0; } session_write_close(); isn't my code simpler? you should read what is posted before posting... Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279037 Share on other sites More sharing options...
Pikachu2000 Posted October 13, 2011 Share Posted October 13, 2011 isn't my code simpler? you should read what is posted before posting... titan21's post was all of 39 seconds after yours. Do you think just maybe it's possible you were both composing your respective posts at the same time? Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279055 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 13, 2011 Share Posted October 13, 2011 most probably, but if im not wrong, the system would inform the user if there was a post being posted. Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279057 Share on other sites More sharing options...
Pikachu2000 Posted October 13, 2011 Share Posted October 13, 2011 That's a selectable option. Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279058 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 13, 2011 Share Posted October 13, 2011 ouh. ok then. sorry titan21 Quote Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.