Jump to content

timed access


g2g

Recommended Posts

hi guys,

 

i was wondering if someone could help me set up a timed access system with php and mysql where visitors of my site could buy access to a copy righted article for a specified amount of time, after which they'd no longer have access to it. the help will be really appreciated.

 

Thanks in anticipation.

 

Link to comment
https://forums.phpfreaks.com/topic/43872-timed-access/
Share on other sites

That souldn't be a hard problem at all.  Here's how I would do it:

 

1.  Create a MySQL db to hold your content (really don't know what your content is, is it word docs or what?)  I wouldn't store pictures, word, pdf, or other large blob data types in the db if I could avoid it. 

2.  On the table that identifies your data, I would place a simple time stamp in it, maybe start_access time or something. In conjunction with this time, I would use a flag (maybe a integer 0 and 1). 0 meaning no access and 1 meaning access.  You can use php to use the date function to test the entry date with the current date via cron job or something maybe at midnight daily.  This cron job can turn all of the 1's off by updating the DB where the time has expired and the current flag is "1".  You could also go a step further and create a text log or email report daily of who's removed (i.e. set to "0"). 

 

Again, this may not be the best way to do this, but I've created something similar and it works beautifully.  The PHP should be simple enough to create.  If you have access to Linux then the cron jobs would be easy as well.  If you use windoze, then use the "AT" cmds to accomplish the same thing.  Hope this can at least get you a start.

Link to comment
https://forums.phpfreaks.com/topic/43872-timed-access/#findComment-213004
Share on other sites

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.