Jump to content

php help: allow member once-per-day access


mm559

Recommended Posts

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!

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.