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
https://forums.phpfreaks.com/topic/37262-ip-capturing-script/
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
https://forums.phpfreaks.com/topic/37262-ip-capturing-script/#findComment-177977
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
https://forums.phpfreaks.com/topic/37262-ip-capturing-script/#findComment-178013
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
https://forums.phpfreaks.com/topic/37262-ip-capturing-script/#findComment-178014
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.