Hi folks.
I am kind of a newbie on PHP coding and I am not yeat an expert on the way PHP always needs a submit in order to run code.
That's why I am having a problem trying to implement my customer's requirement.
He wants the login form to get temporarily deactivated after 5 unsuccessful attempts to log in (kind of "take 30 seconds to remember your password") and then get activated again and so on.
I've tried to use the sleep function after displaying the 5th "password incorrect" error but I can't find the way to submit the form automatically once the waiting time has passed.
I also tried using Javascript, but as it cannot change the value of Session variables, I couldn't find the way either.
I would really appreciate it if someone knows the solution. It would be quite useful to know how to send a submit order in a syncronous way for other uses.
Cheers in advance.
m.
Temporary form controls de-activation using PHP
Moderator: General Moderators
Re: Temporary form controls de-activation using PHP
Can't you just use php?
As in:
As in:
Code: Select all
echo '<script>var timeout = '.$timeout.';
//do stuff with timeout
</script>';Re: Temporary form controls de-activation using PHP
Hi Jackpf.
I am not sure what you mean with using PHP... that's Javascript, isn't it?
If so, I have no idea about how to manage Session variables from Javascript... I am quite sure it can't be done.
Could you please explain your approach?
Cheerio
m.
I am not sure what you mean with using PHP... that's Javascript, isn't it?
If so, I have no idea about how to manage Session variables from Javascript... I am quite sure it can't be done.
Could you please explain your approach?
Cheerio
m.
Re: Temporary form controls de-activation using PHP
As in, define a variable in javascript, with php.
Like defining a normal variable: var something = 'something';
Within the php script, you can define a javascript variable to the session, such as: <?php echo 'var something = \''.$_SESSION['something'].'\';';
Now the variable "something" (in javascript) will contain whatever is in the php session 'something'.
I didn't use
Like defining a normal variable: var something = 'something';
Within the php script, you can define a javascript variable to the session, such as: <?php echo 'var something = \''.$_SESSION['something'].'\';';
Now the variable "something" (in javascript) will contain whatever is in the php session 'something'.
I didn't use
Code: Select all
tags since it strips out escaped quotes (like it did in my last post).
Anyway, I hope this makes sense.