PDA

View Full Version : no more data posts within 30 second. how to do that


Oracle simsim
02-14-2012, 02:51 PM
Hello

I have made a mini plugin that enable my members to choose their mood directly from the a button in the header. when that button pressed the following happen:

1- a prompt box will be shown asking the member about his mood
2- if member write something, an ajax post request will be sent to the server.
3 using a plugin in misc.php, the request will be validated and processed then update the associated userfiled.

I want to prevent members to change their moods frequently . I mean if any member request to change his/her mood. it will not be allowed to change it again within 30 second or less or more.

how vbulletin prevent the user from writing another post with 30 second ? same idea

forgive my weak English and bad title. Any small information will be helpful.

kh99
02-14-2012, 02:58 PM
When a user posts, the lastpost time is saved in the user table. When the user posts again, the lastpost time is subtracted from the current time and compared with the setting.

Oracle simsim
02-14-2012, 03:15 PM
When a user posts, the lastpost time is saved in the user table. When the user posts again, the lastpost time is subtracted from the current time and compared with the setting.


aha .. that's mean I need to save the current timestamp along with mood data then query that value before validating the request. I thought there is a function or global value that I can check against.

thanks