Hi i want to create a simple site similar to twitter that lets user update their status on what they are doing. Can someone help how to create a script written in php that prevent user to post many status at the same time?
A script preventing spam should be the least of your worries. If you can code a Twitter clone, you can easily implement a feature as simple as flood prevention.
I'm sorry to say, but words "twitter" and "simple" should not be used in the same sentence. If you believe coding Twitter-like site is as easy as 1-2-3, coding powerful antispam script should take no longer than 1 minute for you.
In short idea of such a script can be the following. Remember date and time of latest status. Check if some time pased (2 minutes for example) from latest status change. If passed - allow to change status, if not - disallow or show captcha. For those whos taking about "simple" and "twitter", miexl said "similar to twitter". He just want to let users change statuses, he is not talking about any friends or retweets or anything like that.
If you read my post you'd realize I said "you can easily implement a feature as simple as flood prevention." Which should take no longer than 5 minutes to code.
As above said, flood prevention is very easy. Something as simple as using timestamp field with each status entry within your database. Then looking up the last known entry for that user; grab the time stamp and compare that against the current time() to provide you with a value of how long they have waiting inbetween posting new status's.
here's what comes to mind for me 1. user registration required 2. user logs in to post 3. post status posted with timestamp 4. user can't repost within 30 seconds of last post