TJMAudio Posted January 31, 2007 Share Posted January 31, 2007 How would I make it so a page would only be displayed once every 24 hours if a user has clicked a link? Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/ Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 record the time they click on it first, then don't let them do it if it's been less than 24 hours. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173953 Share on other sites More sharing options...
TJMAudio Posted January 31, 2007 Author Share Posted January 31, 2007 record the time they click on it first, then don't let them do it if it's been less than 24 hours. That's the general idea, yes. Back to my question; how would I do it? Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173959 Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 That's up to you. If you start somewhere and run into trouble, we can offer more help. You'll likely want to store these times in your database. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173961 Share on other sites More sharing options...
TJMAudio Posted January 31, 2007 Author Share Posted January 31, 2007 That's up to you. If you start somewhere and run into trouble, we can offer more help. You'll likely want to store these times in your database. So I come here for help, and all I get is figure it out yourself? Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173968 Share on other sites More sharing options...
HuggieBear Posted January 31, 2007 Share Posted January 31, 2007 I think what Jesi's trying to say is, we're not here to do it for you. If you have attempted some code already then post it here and we can point you in the right direction. OK, so are the people that visit the page registered in some way or are they just random visitors to the site? Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173971 Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 I think what Jesi's trying to say is, we're not here to do it for you. If you have attempted some code already then post it here and we can point you in the right direction. Exactly. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173974 Share on other sites More sharing options...
realjumper Posted January 31, 2007 Share Posted January 31, 2007 If I were you I'd use a cookie. See http://www.websitepublisher.net/article/php_cookies/ In the cookie I would store the the time 'right now', and expire the cookie in 24 hours from now. See http://www.plus2net.com/php_tutorial/php_date_time.php On your page check to see if a cookie exists. If it does, send the user away as they are still within the 24 hours limit. If no cookie exists, let them see the page. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173976 Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 That won't work, as Cookies can easily be deleted or edited by the user. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173977 Share on other sites More sharing options...
ikmyer Posted January 31, 2007 Share Posted January 31, 2007 does everyone get to click it once a day ? Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173980 Share on other sites More sharing options...
realjumper Posted January 31, 2007 Share Posted January 31, 2007 It will work. Most people don't know how to delete or manipluate cookies. If the protected page is very important, then I agree that there are better methods such as using a database to store the timestamp. However, I have set the poster in a direction that he/she will learn something rather than just an unhelpful 'that's up tp you' comment. Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173982 Share on other sites More sharing options...
boo_lolly Posted January 31, 2007 Share Posted January 31, 2007 That's up to you. If you start somewhere and run into trouble, we can offer more help. You'll likely want to store these times in your database. So I come here for help, and all I get is figure it out yourself? jesi can be like that sometimes. just brush it off. but she IS right... cookies are NOT the way to go with this one. it's gotta be stored in the database. i will help you approach this issue. but first, i'm gonna need a little more info. a user clicks a link, and then what? taken to a page? what page? where? when would the user be at a page where they would see this link again? do you want the link to be there, except not an active link? or do you want nothing to show up? huggie's got a good question, are these registered users? that is an extremely important question that will heavily dictate the method of pursuing this issue Quote Link to comment https://forums.phpfreaks.com/topic/36532-only-letting-a-user-click-a-link-once-every-24-hours/#findComment-173988 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.