oliverw92 Posted May 3, 2008 Share Posted May 3, 2008 hi, im making a graphics resource submission system for a gfx site, and i was wondering if theres a way i can do a 'timer' or something similar so someone can only submit a resource/click the submit button once every 5 minutes, to stop spamming. anyway to do this? also does anyone have experience with invision power boards and how to build mods into it? id like to try and integrate this project directly into it. Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/ Share on other sites More sharing options...
p2grace Posted May 3, 2008 Share Posted May 3, 2008 If you're not tracking username (there are a number of ways to do this): One is to create a cookie that exists for five minutes, and before saving the variable check if that cookie exists, if it does don't allow the submission. Another option would be to track submission ip addresses in a mysql database, and check if the submission from a given ip address is at least 5 minutes older than the last one from the same ip address. If you're tracking username: Save the last submission date in the users table, and check if the current submission is at least 5 minutes after the last one. Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532440 Share on other sites More sharing options...
ohdang888 Posted May 3, 2008 Share Posted May 3, 2008 or you could use a session... $_SESSION['last_post'] = date(your format); Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532456 Share on other sites More sharing options...
p2grace Posted May 3, 2008 Share Posted May 3, 2008 Sessions would only work if they don't close their browser though Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532479 Share on other sites More sharing options...
oliverw92 Posted May 4, 2008 Author Share Posted May 4, 2008 ah i get you. ill probs store the ip of the person actually and store the time, and then check if the time between is > 5 or if there is any entry. anyone know anything about invision power boards? like, how dyu integrate the invision skin with a php addon. and also im going to have a drop down, and when i click on a certain line in that drop down, i want to have it make another drop down appear according to which one i click first. how woudl i go about this? Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532489 Share on other sites More sharing options...
blueman378 Posted May 4, 2008 Share Posted May 4, 2008 well your last part is javascript not php possibly ajax though, check this out i believe its what your after: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html dir="ltr" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Dynamic Select Boxes example</title> <style type="text/css"> </style> <script type="text/javascript"> function populate(o) { d=document.getElementById('de'); if(!d){return;} var mitems=new Array(); mitems['Main Courses']=['Burger Meals','Breakfast','Steaks','Fish Dishes','Vegetarian Dishes']; mitems['Snacks']=['Brownies','Cookies']; mitems['Drinks']=['Shakes','Sodas','Cocktails','Juices']; mitems['Salads']=['Tuna Salad','Cesar Salad','Green Salad','Prawn Salad']; mitems['Deserts']=['Pancakes','Waffles','Ice Cream','Fresh Fruit']; d.options.length=0; cur=mitems[o.options[o.selectedIndex].value]; if(!cur){return;} d.options.length=cur.length; for(var i=0;i<cur.length;i++) { d.options[i].text=cur[i]; d.options[i].value=cur[i]; } } </script> </head> <body> <form action="" method="get"> <label for="or">Our menu:</label> <select name="or" id="or" onchange="populate(this)"> <option value="Main Courses">Main Courses</option> <option value="Snacks">Snacks</option> <option value="Salads">Salads</option> <option value="Drinks">Drinks</option> <option value="Deserts">Deserts</option> </select> <label for="de">Select:</label> <select name="de" id="de"> </select> <input type="submit" value="Show me" /> </form> <p>Not a real menu, dudes. This is only a demo. Everything works, but there are no subpages to click to.</p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532504 Share on other sites More sharing options...
oliverw92 Posted May 4, 2008 Author Share Posted May 4, 2008 ah i see. never done javascript before, but i get how it works from other languages. how would i make it so it autofills the second drop down when you first start the page. cos with that one, when u first load the page it doesnt put anything in the second box. Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-532795 Share on other sites More sharing options...
blueman378 Posted May 5, 2008 Share Posted May 5, 2008 hi just put the optinos you want to show initially in between the: <select name="de" id="de"> </select> Link to comment https://forums.phpfreaks.com/topic/103998-submission-limit-timers-or-something/#findComment-533309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.