kevinak Posted September 2, 2008 Share Posted September 2, 2008 I have a site that using phpbb3 forum login integration. Just incase you need to know that. But I'm looking for a way to only allow a person to do the actions on my php script Once per day. As such, when they haven't visited for one day, then it will do the actions of the script, but if they have already visited it in the past 24 hours, I want it to not do these actions and simply say something like you have already done this in the past 24 hours. Any suggestions? Thanks so much for reading and for any responses. Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/ Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 Make a table 3 fields ActionID UserID DateTime When a user does an action insert into and delete (or update) that users row for that action so the DateTime = NOW() When the user attempts to do the action again check to see if the date of their last action is acceptable for them to do this action now (if so then do it) Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-631994 Share on other sites More sharing options...
kevinak Posted September 2, 2008 Author Share Posted September 2, 2008 Wow. Such a great idea. Thank you for replying, but I forgot to mention something. This is going to have to work on thousands of pages.. haha I used GD commands to render an image. The image then gets information from my database off the extension of the URL. Example. www.whimpsters.net/pets.php/1 This makes every number gather different information. And there is a potential to have 1,000's. So I would think 1,000+ members each being able to click on of these 1,000+ images, would be overload to your solution? Or am I wrong? Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632003 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 for 15 bytes of data stored a million times not really. From the sounds of it any solution will be extensive. You may be able to force MySQL into doing it all internally and then making queries fail through that but that is a very adavnaced idea Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632008 Share on other sites More sharing options...
kevinak Posted September 2, 2008 Author Share Posted September 2, 2008 Ok, that seems like a solid plan. How would I go about adding 24 hours to the Now() function. Also should I use a datetime var in my database for the datetime column and will Now() return results that can be stored into that var? Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632026 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 This might help http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632038 Share on other sites More sharing options...
kevinak Posted September 2, 2008 Author Share Posted September 2, 2008 Yes thanks so much. I got it running perfectly. I just have php find the day of the month and then see if it's equal to the day in the database for each user_id and pet_id. Simpleee Thanks so much Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632222 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 make sure u store as a date because they its really storing an integer instead of a varchar field type = less data space Link to comment https://forums.phpfreaks.com/topic/122394-tracking-one-ip-per-day/#findComment-632269 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.