Jump to content
Killersites Forums

HOW TO COLLECT IP ADDRESS WITH PHP


Recommended Posts

HI

how do i collect people who fill out form ip address so i can control spam .

i am currently is using php form to contact me how ever i want to also add there unique ip address when the form is sent to be

here is my file contact.php

 

 

03.png Contact Us

 

bigEmail.png

customerservice.JPG

Name: *

 

 

 

 

Phone: *

 

 

 

Email: *

 

 

 

 

Your comments: *

 

 

 

 

 

 

and here is my send.php

 

<?

if (isset($_POST['name']) && !isset($_POST['freequote'])) {

$MSG = 'Contact Us:

';

$MSG .= (isset($_POST['name']))? 'Name = '.$_POST['name']."

" : '';

$MSG .= (isset($_POST['phone']))? 'Phone = '.$_POST['phone']."

" : '';

$MSG .= (isset($_POST['email']))? 'Email = '.$_POST['email']."

" : '';

$MSG .= (isset($_POST['comment']))? 'Comments = '.nl2br($_POST['comment'])."

" : '';

$MSG = "

$MSG
";

$headers = "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=windows-1255\n";

$headers .= "From: Movers Community \n";

$st = mail('avidanbanks@gmail.com moversleads@gmail.com', 'From website', $MSG, $headers);

header('location: thanks.php');

exit();

 

were do i put a code to collect the person unique ip address and send it to me so i can see who is on my site ?

 

please advise

Link to post
Share on other sites

Hi,

 

$_SERVER['REMOTE_ADDR']

 

This picks up the IP address of the user sending the form.

 

Here's how you can add it to your script, find this part:

 

$st = mail('avidanbanks@gmail.com moversleads@gmail.com', 'From website', $MSG, $headers);

 

Change it to:

 

$subject = "From Website: ".$_SERVER['REMOTE_ADDR'];

$st = mail('avidanbanks@gmail.com moversleads@gmail.com', $subject, $MSG, $headers);

 

Dean

 

 

HI

how do i collect people who fill out form ip address so i can control spam .

i am currently is using php form to contact me how ever i want to also add there unique ip address when the form is sent to be

here is my file contact.php

 

 

03.png Contact Us

 

bigEmail.png

customerservice.JPG

Name: *

 

 

 

 

Phone: *

 

 

 

Email: *

 

 

 

 

Your comments: *

 

 

 

 

 

 

and here is my send.php

 

<?

if (isset($_POST['name']) && !isset($_POST['freequote'])) {

$MSG = 'Contact Us:

';

$MSG .= (isset($_POST['name']))? 'Name = '.$_POST['name']."

" : '';

$MSG .= (isset($_POST['phone']))? 'Phone = '.$_POST['phone']."

" : '';

$MSG .= (isset($_POST['email']))? 'Email = '.$_POST['email']."

" : '';

$MSG .= (isset($_POST['comment']))? 'Comments = '.nl2br($_POST['comment'])."

" : '';

$MSG = "

$MSG
";

$headers = "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=windows-1255\n";

$headers .= "From: Movers Community \n";

$st = mail('avidanbanks@gmail.com moversleads@gmail.com', 'From website', $MSG, $headers);

header('location: thanks.php');

exit();

 

were do i put a code to collect the person unique ip address and send it to me so i can see who is on my site ?

 

please advise

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...