Answer the question
In order to leave comments, you need to log in
How to open access to the site for a while?
For example, I uploaded a site to github and now it is necessary to give a potential buyer a demo of the site upon request, say for 5 minutes. I don’t quite understand how to implement this ...
No, you can, of course, go to the end and add / remove a redirect line to another site in htaccess, but I think this is nonsense, is there probably an adequate solution?
UPDATE
I need to make it impossible even to get to the site (more specifically, so that it is impossible to view files via devtools), and if these 5 minutes run out, then kick the user out of the site.
Answer the question
In order to leave comments, you need to log in
Make a demo user who will have access to everything you need. And by the way, you can redirect simply from php, why htaccess?
The idea is IMHO crazy (who needs to save what he needs in a couple of minutes), but these are your questions ...
Pass the client a link with a randomly generated hash (for example, from microtime + salt), and write the hash to the database. At the first entry, write the activation start time to the database; for further transitions, check whether 5 minutes have passed (track by session). If passed - throw it on the stub.
This implementation does not guarantee that if a person has spent 20 hours on 1 page, he will be thrown out "automatically". Only on the next request to the server.
In principle, you can also tie a javascript that will reload the page on a timer and throw it out of the system, but this protection of the level of the “do not walk on the lawns” sign costs at a time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question