My Code Doesn't work.. How Can I get IP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaksho
Forum Newbie
Posts: 1
Joined: Wed Sep 23, 2009 6:41 am

My Code Doesn't work.. How Can I get IP

Post by yaksho »

Hello,
Actually My codes is not working. I'm getting blank in pace of IP of client when form is submitted... My code is given below.

<?
$Rad = $_SERVER["REMOTE_ADDR"];
$Rad1=$_SERVER["SERVER_NAME"];
$Rad2=$_SERVER["HTTP_USER_AGENT"];
$recipient = "info@xyz.com";

$name = $HTTP_POST_VARS['Name'] ;

$email = $HTTP_POST_VARS['Email'] ;

$msg = "
TibetShop.biz - Thanka Details
=====================================

Date = $dated \n
Client IP address =$Rad
Referral Site = $Rad1
Client Browser = $Rad2
Client IP address =$REMOTE_ADDR
Client Browser = $HTTP_USER_AGENT
Referral Site = $HTTP_REFERER \n\n\r

Business name : $HTTP_POST_VARS[business_name]
Name and Title : $HTTP_POST_VARS[name_title]
City and State : $HTTP_POST_VARS[city_state]
International Airport nearest you : $HTTP_POST_VARS[airport]
Country : $HTTP_POST_VARS[country]
Your email : $HTTP_POST_VARS[email]
Subject : $HTTP_POST_VARS[subject1]
One Main figure or many : $HTTP_POST_VARS[figure]
Preferred Net Sizes : $HTTP_POST_VARS[size]
Quantity desired : $HTTP_POST_VARS[quantity]
With or without brocade : $HTTP_POST_VARS[brocode]
Presence of Gold : $HTTP_POST_VARS[gold]
New or Antique Thanka : $HTTP_POST_VARS[type]
Main interest in : $HTTP_POST_VARS[interest]
Delivery Time : $HTTP_POST_VARS[time]
Comments : $HTTP_POST_VARS[comments]
";


//echo $msg;

/* subject */

$subject= "Inquiry from TibetShop.biz - Thanka Details";

/* additional header pieces for errors, From cc's, bcc's, etc */

$headers .= "From: $email\n";
$headers .= "X-Sender: <info@xyz.com>\n";
$headers .= "X-Mailer: CZN FormMailer 1.0.01\n"; // mailer
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: <$email>\n"; // Return path for errors


//MAILING NOW

$success=mail($recipient, $subject, $msg);

//echo(nl2br($msg));
unset($headers);
unset($subject);
unset($msg);

if (!$success) {
echo "ERROR PLEASE CONTACT WEBMASTER (info@xyz.com) ";
//ERROR MESSAGE (TODO: in 2nd version)
}else{
@header("Location: thankyou.php");
}
?>
User avatar
lord_webby
Forum Commoner
Posts: 44
Joined: Wed Aug 19, 2009 9:01 am

Re: My Code Doesn't work.. How Can I get IP

Post by lord_webby »

Change:

Code: Select all

Client IP address =$REMOTE_ADDR
To

Code: Select all

Client IP address =$Rad
Post Reply