Jump to content

Capturing IP Address and Browser info


yana

Recommended Posts

I am using the following two methods now to capture above mentioned info:

$ip_address = $_SERVER['REMOTE_ADDR'];

$user_browser = $_SERVER['HTTP_USER_AGENT'];

This user info is captured and sent in an email to me and works perfectly on our Test Server. However, on the Live Server this does not get captured (I get an email with a blank).

What could be the cause of this???
Link to comment
Share on other sites

<html>
<body>
<?

$ip_address = $_SERVER['REMOTE_ADDR'];

$user_browser = $_SERVER['HTTP_USER_AGENT'];

//add From: header
$headers = "From: \"Online Survey\" webserver@localhost\r\n";

//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";

//unique boundary
$boundary = uniqid("HTMLDEMO");

//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
  "; boundary = $boundary\r\n\r\n";

//message to people with clients who don't understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";

//HTML version of message
$headers .= "--$boundary\r\n" .
  "Content-Type: text/html; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("IP Address: $ip_address Browser: $user_browser"))

//send message
mail("yana@greatgulfhomes.com,yanochka_@hotmail.com", "Online Survey", "", $headers);

?>
</body>
</html>
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.