devxtec Posted April 8, 2006 Share Posted April 8, 2006 I'm slightly new to php and I've been looking all over for tutorials on how to do what I'm trying to do and haven't found anything yet.I'm trying to take a contact form I made using php and make it so that it will only allow a visitor the ability to fill out the form and send it once every 15 minutes. How can implement this using php? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 8, 2006 Share Posted April 8, 2006 in the form that teh user fills in have...<input type="hidden" name="IPADDY" id="IPADDY" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">now on submission of the form have a table to log ipaddy and the time...$query = mysql_query("INSERT INTO `iplog` (`ipaddy`,`time`) VALUES ('" . $_POST['IPADDY'] . "', '" . mktime() . "');before you add that line query the table for that ipaddress and se if the corresponding time is > (mktime() - (60 * 15)) if it is they tried less than 15 mins ago so display a message telling thme so. If not process the formand add that info to your log table. Quote Link to comment Share on other sites More sharing options...
devxtec Posted April 8, 2006 Author Share Posted April 8, 2006 Thanks for the quick reply. I'll give it a shot! =D Quote Link to comment Share on other sites More sharing options...
txmedic03 Posted April 14, 2006 Share Posted April 14, 2006 Not a good idea to pass the IP from the form. Someone could easily create a form on their desktop that passes anything they want to your page and still spam it. Better to obtain the IP address from $_SERVER['REMOTE_ADDR'] on the page that processes the form or use sessions. 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.