Jump to content

IP capturing script


pkirsch

Recommended Posts

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").

Link to comment
Share on other sites

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.
}

Link to comment
Share on other sites

You are correct indeed!  :D

 

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?

:)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.