javascript disable countdown edit


#1

hello
i have made this code for my website

my php file set counter to some number lets say 10
after this script does countdown when its <=1 it shows button which goes to link
my question is
how can i prevent countdown editing?

countdown starts from 60 to down but you can easily inspec element and change number to 3 so u dont need to wait 60 seconds when someone will change it to 3 it will go back to 59 or whatever number it is

i already tried

<?php
echo"
";

?>

please help


#2

You can’t, code that’s running in the client side will always be editable client side. If it’s some kind of real time restriction you can save the start time on the server side (ie in the session) and enforce any future requests compared to the start time. That way the client side countdown is a convinience tool for the user only, and not a security measure (which it should never be)


#3

stupid me how didn’t i think of that before, thanks