Answer the question
In order to leave comments, you need to log in
How to make a self-deleting link live in time?
Hello!
Tell me how to make the link live for a specific time, from the moment of entry, and the time was fixed according to the time spent on it.
Answer the question
In order to leave comments, you need to log in
Since the MySQL tag is worth it, I assume that the links are stored in the database?
So for each link you need to make a column with the time the link was created and the time of the first click (visit) on it.
Link creation time can be used if it is necessary, in principle, to limit the link in time, regardless of whether it was visited or not.
Default entry time null
. When opening a link, we look at this value, on the first visit we fill in the current date, on repeated clicks we compare the date and current time.
If more than a certain time has passed, we consider that the link has been deleted.
You can also actually delete links with an expired date from the database, while links where the visit date null
is considered not visited and are not deleted. It already depends on your requirements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question