mm559 Posted July 23, 2010 Share Posted July 23, 2010 Been searching everywhere and I can't find the solution, but I know it must be out there... I am looking for a function that will allow members to print/view items on my site, but only once per day. In other words, certain members-only content is available to view/print, but I want to limit 'viewability/printability' to once per day per member. Once an item is viewed, it will not be available again to that member until the next day. Does anyone know how to accomplish this? Thanks! Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 23, 2010 Share Posted July 23, 2010 There's many ways to do it. One very standard approach would be to keep a database table that has a simple structure like: asset userid timestamp When someone attempts to access an asset, you first do a query from the table to see if there is a row that exists for today. Assuming a mysql database table, this is a very simple query that uses mysql's date functions for comparison. Once you determine that they haven't looked at the asset today, you let them see it, and call a routine to insert a row for that asset in the database. Quote Link to comment Share on other sites More sharing options...
mm559 Posted July 23, 2010 Author Share Posted July 23, 2010 Cool, thanks! That sounds like the solution I need... unfortunatly I am pretty new to php and don't exactly know how to do what you've said. Can you tell me where to find more info, or provide a little more detail? Thanks! Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 23, 2010 Share Posted July 23, 2010 You probably want to start by creating the mysql table. Then you can simply read the php manual on how to do an insert statement and select. http://us2.php.net/manual/en/mysqli.query.php Quote Link to comment 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.