pkirsch Posted February 6, 2007 Share Posted February 6, 2007 After submitting a form on a page, what's the best way to capture the submitter's IP address and add it to a php file that will deny them from coming back to that same page again after submitting the form? (for example, if they try to revisit that same page, the php script will report a message back stating "sorry, you've already been there"). Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 i am assuming this is for your rating system as well. add another table called rated or something. have 3 fields, id, rate_id and ip. when they submit there rating the first time add a new row to this table with there ip ( $_SERVER['REMOTE_ADDR']; ) and the id of the poll. then when they vote again check that newly created table. $id = $_POST['poll_id']; $query = mysql_query("SELECT * FROM rated WHERE `ip`='{$_SERVER['REMOTE_ADDR']}' AND `poll_id`='{$id}'"); if(mysql_num_rows($query) == 1){ echo "You have voted."; }else{ //do the votnig. } Quote Link to comment Share on other sites More sharing options...
pkirsch Posted February 6, 2007 Author Share Posted February 6, 2007 You are correct indeed! But lets say that i needed to make an IP capturing script (php of course) for a a Form (fill in the data and press submit) and from then on that user using that IP would not have access to that file! What about doing the same thing just with a folder? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 i guess you could get the name of the folder and check if that user cannot access the folder. by doing the same as above by with the folders name. just modify it around a bit. have an include script on each of the pages in the folder that will exit() the script if they are trying to access the folder and they are not aloud. 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.