Jump to content

double clicking on menu or form buttons is causing unwanted logouts


ajoo

Recommended Posts

Hi all. I have just created a login page which logs a person into a page with menu buttons. However, i have noticed that if, inadvertently, i double click any of the menu buttons or the other form submit buttons, i get logged out. 

 

I think this is because of the session_regenerate_id that i used for the login purpose and which I don't want to change. So I would like to know if there is some way to ignore subsequent clicks for a certain period of time once the button has been clicked. For e.g. if i have clicked a submit button, then i want that any further clicks on the same button be ignored if they occur within say 500ms of the 1st one. Something like that. Or better still if the subsequent clicks are ignored until the previous button action has been completetd once it is clicked. 

 

Again for e.g. if i a submit button is accessing a database and takes say 300ms to retrive and display that information, then once that button has been clicked, subsequent clicks on it should be ignored - in this eg. for 300 ms - till the previous button action is complete.

 

Implore all the gurus for their invaluable inputs and guidance.

Thanks all ! 

Link to comment
Share on other sites

Hi  Ok so i took a quick look at the article and its using javascript which i wanted to avoid since I am mainly using php. Frankly I have tried a similar approach in php by using variables and checking their value just before the button click. In fact the button is supposed to be displayed only if the value is true.

<? if isset($button) && ($button==true) ?> <input type = "submit" name = "submit" value = "Submit" > 

However this does not seem to work. 

 

So is there any other way to achieve this without the javascript or is that a must. Thanks again for the reply and definitely looking for some more information on this one.

 

Thanks.

Link to comment
Share on other sites

How about something like this:

$stamp=time();
if ($_SESSION['clicktime']<date("Y-m-d H:i:s", $stamp-1)){
$_SESSION['clicktime']=date("Y-m-d H:i:s"); //set the last click time for the next click
//do your stuff here
}else{
//it was within a second so don't do anything or send a double click message or log it or whatever
}

Thanks to this post for the idea http://forums.phpfreaks.com/topic/239754-addsubtract-one-second-from-datey-m-d-his/

Edited by davidannis
Link to comment
Share on other sites

if someone is getting logged out due to normal/likely user actions, that indicates you have a problem in your code. putting a band-aid over the tail-end of the problem isn't going to fix it.

 

your first step would be to find out exactly what is causing the logout to occur.

 

and based on your thread started after this one, your symptom of the login panel reappearing is likely the symptom of the logout state. fix the problem in this thread, and the other problem will likely go-away.

Edited by mac_gyver
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.