I believe this can be solved as follows:
$hora = time();
$id = //id qualquer;
$seulink = "ativacao.php?id=" . $id . "&hora'=" . $hora;
And in the activation.php file you do the logic to check if the $hora
parameter has a difference of more than half an hour from the current time. If it is larger, it does not allow activation.
You can also generate a hash based on the value of the current time and ID (to prevent the user from changing the value of &hora
manually) and validate if that hash is possible at the time of the check in activation.php.
Since you want to disable the link after first use, you can create a table in the bank with two columns: id
and jaUtilizado
(boolean) and ativacao.php
would make a select in the database by the id passed via parameter in url. If the jaUtilizado
column is marked for that Id to activate at that point. If it is not marked, mark it and continue with the process.