javascript - how can I make a countdown timer perform an action when it runs out? -
this first question here , may not meet standards, apologize in advance. have site developed in laravel 5 users register , expected make take action within specific period after registration. have included countdown timer purpose (the time code shown below). need automatically remove user record database when time runs out. please how can that? timer code is:
<div class="getting-started"></div> <?php $time = strtotime($user['updated_at'].'+24 hours'); $countdown = strftime('%y/%m/%d %h:%m:%s',$time); ?> <script type="text/javascript"> $(".getting-started") .countdown("{{$countdown}}", function(event) { $(this).text( event.strftime('%h:%m:%s') ); }); </script>
if want happen on server, should maintain timer on server side, not client side. otherwise, user can change timer or otherwise block action expiration meant trigger. store timestamp user record, noting when created. write script loop on records older threshold , perform desired action on them. run script via cron fires @ regular interval.
Comments
Post a Comment