Crypt Posted April 28, 2006 Share Posted April 28, 2006 I would like to incorperate this into my "tag-board" where after they post a message it bans their ip from posting another one for 1 day.. Quote Link to comment Share on other sites More sharing options...
Orio Posted April 28, 2006 Share Posted April 28, 2006 Have a table called lets say ipban, which has a column called IP and a column called timestamp.Then, when the user posts check:[code]$ip = getenv('REMOTE_ADDR');$sql="SELECT timestamp FROM `ipban` WHERE IP='$ip' ORDER BY timestamp ASC LIMIT 1"; //we want the last time stamp of the user's IP$result=mysql_query($sql);if(mysql_num_rows($result)>0){$last_ban=mysql_result($result, 0);$24h=60*60*24;$ban_until=$lastban+$24h;$now=time();if($ban_until>$now){die("You cant post more than once in 24 hours.");}};//rest of code[/code]Hope it helps,Orio. Quote Link to comment Share on other sites More sharing options...
Crypt Posted April 28, 2006 Author Share Posted April 28, 2006 Thank you very much, hope this works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.