mssakib Posted September 7, 2011 Share Posted September 7, 2011 Hi I want to make something like this - My Sites index.php will be avail avail to user after he has clicked in a link that will come after every 24 Hour in my site. Means when a user first enters the site it will come and clicking in there the site will be avail avail. again after 24 Hour it will come again. But i am not getting how to do it. So need help SaKIB Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/ Share on other sites More sharing options...
codefossa Posted September 7, 2011 Share Posted September 7, 2011 Just add (time() + (24 * 60 * 60)) to the database when they click it. If time is after timestamp in database, then have them click it again, and again update the column. Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266609 Share on other sites More sharing options...
xyph Posted September 7, 2011 Share Posted September 7, 2011 So you only want a single user to be able to view the site once every 24 hours? Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266612 Share on other sites More sharing options...
mssakib Posted September 7, 2011 Author Share Posted September 7, 2011 No ip based... Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266613 Share on other sites More sharing options...
xyph Posted September 7, 2011 Share Posted September 7, 2011 So you know how you're going to do it? Give it an attempt, and show us some code. We don't plan on doing it for you. I'd suggest using a database to store the user's IP and last time they visited. Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266635 Share on other sites More sharing options...
mssakib Posted September 7, 2011 Author Share Posted September 7, 2011 So here is plan. And i don't ask code from u ..just need help 1. Storing Users IP and Visit Time in a Database 2.Checking IP , Checking Time .. if 24 not passed then ok. If passed then the window again. right ? Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266636 Share on other sites More sharing options...
xyph Posted September 7, 2011 Share Posted September 7, 2011 That's what I'd do. I'd include a check at the top of EVERY page you want protected, to prevent people from simply bypassing the checking file. Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266638 Share on other sites More sharing options...
mssakib Posted September 7, 2011 Author Share Posted September 7, 2011 Thx i would give it a try. Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266639 Share on other sites More sharing options...
xyph Posted September 7, 2011 Share Posted September 7, 2011 Keep in mind though you have to give a user a certain window of time, otherwise any request after the first will force the user to wait another 24 hours. Perhaps setting the time to 10 minutes ahead of the current time would solve this. You would then have to check if the current time is less than the database time, or if it is at least 24 hours more. Quote Link to comment https://forums.phpfreaks.com/topic/246665-24-hour-page-show/#findComment-1266644 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.