How do I set timed "quests" in PHP.

I have a database ready with all the users etc. How would I go about setting a timer such that only when the time elapses is a user allowed to do a particular function (regardless of whether the users logs out, closes the browser, switches computer etc.)?

For example, this user is only allowed to do something once every 15 minutes, else an error message will be displayed. Can I get the general idea of how to carry this out?

Thank you!