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? 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']++; ?> 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. } ?> 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(); 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... 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? 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. 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. 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 Link to comment https://forums.phpfreaks.com/topic/249050-track-session-requests/#findComment-1279060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.