June 21, 2010

Limit posting to every 30 minutes

Question by jay

Thanks for looking.

I’m trying to write a script to set a cookie after the user posts a comment, limiting them from posting again for 30 minutes. I’m so confused on where to start. Please, could you guys help me out on how I do this?

I’m trying to use this jquery plugin – countdown timer.

Answer by Starx

Use Session

For example, after a post, put the current time + 30 minutes in your session line this
$_SESSION['postTimeFlag'] = time() + 1800;
Then whenever the user is about to post then the session

if(time()>$_SESSION['postTimeFlag']) { 
   //continue posting
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!