Monkuar Posted May 11, 2009 Share Posted May 11, 2009 Make it so the user can only use it once every x minutes or twice every 5minutes or vice versa.. i looked on google for tutorials but i cant find anything and i got no clue it's out of my boundries of knowledge care to help me? and it stores in the users cookie.. [i dont care if people can delete cookie] most wont and kinda need it to be stored in cookie. Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/ Share on other sites More sharing options...
gevans Posted May 11, 2009 Share Posted May 11, 2009 The first time they submit the form store a timestamp in a cookie. Next time the form loads compare the timestamp from the cookie to the curent timestamp. If the difference is less than your time don't let them see the form. Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-831982 Share on other sites More sharing options...
Monkuar Posted May 11, 2009 Author Share Posted May 11, 2009 Thanks for your post.. I dont understand any of that.. omg Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-831983 Share on other sites More sharing options...
gevans Posted May 11, 2009 Share Posted May 11, 2009 Ok..... <?php $the_time_now = (time()+(60*5)); setcookie('form_submit', TRUE, $the_time_now, '/'); That will set a cookie on the users computer called form_submit that will expire in 5 minutes. When you load the form check for the cookie. If it exists, then that computer used the form within the last 5 mins. Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-831985 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 But the user can just clear cookies to bypass that. Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-831997 Share on other sites More sharing options...
Monkuar Posted May 12, 2009 Author Share Posted May 12, 2009 But the user can just clear cookies to bypass that. I know.. but the basics of deleting a cookie and re doing it again again takes time and it's fine.. holy cow man, lol Ok Gevans Is that all i got? form_submit is the name? wat about the else function and if? lol srry im really noob but ur helping me Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-832083 Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Takes time? Dude, I can clear domain cookies in less than 2 seconds. o.O Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-832084 Share on other sites More sharing options...
Monkuar Posted May 12, 2009 Author Share Posted May 12, 2009 well it's better then nothing bro... if they wanted to spam something they would have less action of doing it if they had to delete cookies everytime right ? ya lol Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-832085 Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Or disable cookies. Then they won't have to delete anything. Though you can argue that only someone with intention to screw up your system would go for it. But it that one person succeeds, it can be very annoying. Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-832127 Share on other sites More sharing options...
gevans Posted May 12, 2009 Share Posted May 12, 2009 Well, you've got the code to set the cookie, this is how you check if its still alive <?php if(isset($_COOKIE['form_submit']) && $_COOKIE['form_submit']) { //cookies still there, they submitted the foirm within the last 5 mins } Quote Link to comment https://forums.phpfreaks.com/topic/157742-i-have-a-basic-form-but-i-want-to/#findComment-832235 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.