"Secure" against... what? Is the time supposed to reset if the user refreshes the page or otherwise navigates away from it?
In the end... what you're describing is client-side behavior, so you'd be looking for a client-side technology (hence the moved topic) such as JavaScript.