Capturing IP Address
to capture the ip address of the customer and everything worked great.
$ipadd = $_SERVER[REMOTE_ADDR];
We just added an SSL certificate to make the site more secure and our order page is showing as HTTPS as supposed to HTTP. Now all the orders we receive have the same ip address. I checked the ip address and it is host.
I have no idea how to start troubleshooting. If this is a server problem or the SSL, or wrong php code.
Any help is appreciated.
There is probably a better way to do it, but I am a terrible PHP troubleshooter so look for the fast & easy way.
Here is a hack that you can try:
Put your PHP code inside of an iFrame on the page that is 1px X 1px. You can then have it capture the ipAddresses and be invisible. The iFrame 'content' can be http
Omg, are you talking in latin? Show me an example. I do not understand a word you said. I am not a programmer, lol.
An iframe is simply like a little window that another page can appear inside of. All of the code on that page will run.
So you should put your PHP code that captures the IP address on its own page. Name that page something like: ipcapture.php
Then, simply put it on your https page like this:
That should do it... it's a hack, but it's worth a try.
<iframe width="1" height="1" src="ipcapture.php">You need a frames capable browser to see this content.</iframe>
Hope that helps.
I sent an email to our host and this is what they said: "I am sorry to hear that you were experiencing issues with your secure page. All https requests to our Hosting Packages go through a Proxy server. This is necessary because your Hosting Package does not have a dedicated IP address. If you need a true dedicated IP address, you would need a Virtual Private Server (VPS)."
VPS will cost us $40 a month as supposed to $160 a year on shared hosting. lmaooooooo! Is there really no other way to capture the user's ip w/o having our own VPS?
Try this: http://roshanbh.com.np/2007/12/getti...ss-in-php.html
The 'HTTP_X_FORWARDED_FOR' can contain a comma delimited list!
Wow Fang, thanks. Right now, I am doing it this way:
$ipaddy = $_SERVER[REMOTE_ADDR];
Problem is, how do I call the function or where do I place the code? I am not a programmer
$ipaddy = getRealIpAddr();
I placed the function right after the variable was declared and it did not work I am so frustrated. Should the function be in the html section of the page?
$ipaddy = getRealIpAddr();
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
First the function then the variable
Arrrg, did not work either! I wonder if has something to do with how we gather the information and how they are being sent. Below is what we use:
$mailheaders = 'Content-Type: text/plain;'.$lterm;
$mailheaders .= 'X-Mailer: PHP;'.$lterm;
$mailheaders .= 'X-MSMail-Priority: High;'.$lterm;
$mailheaders .= 'X-Priority: 1;'.$lterm;
$mailheaders .= 'Return-path: '.$mailfrom.$lterm;
$mailheaders .= 'Sender: '.$mailfrom.$lterm;
$mailheaders .= 'From: '.$mailfrom.$lterm;
$mailheaders .= 'Cc: '.$mailcopy.$lterm;
$mailbody = "email body
IP Address: $ipaddy" .$lterm;
if (mail($emailadr, $mailsubj, $mailbody, $mailheaders, "-f $mailfrom")):
$messages = 'Failed to send email!';
<form action="<?=basename($_SERVER['PHP_SELF'])?>" method="post">
You don't need to buy a VPS just to get a private ip. Every shared host that doesn't suck offers private ip addresses for 2-3 extra dollars per month.
Originally Posted by xoxLISAxox
I just called our provider. Unfortunately they do not offer a private ip address without switching to a Private Virtual Network that cost $40 a month
You may want to consider changing hosts. I have an https server setup with hawkhost.com for $6 / month + $2 for the private ip which I just checked and the $_SERVER['REMOTE_ADDR'] value is set correctly to my ip address. If that's too much trouble then you may just snag the users ip via http as previously suggested.
Chances are you already have an opportunity to store the customers ip before they get to the secure server. You can probably just store the customers ip in their session at that point.
Note that your hosts http and https servers may not share the same session store by default but if they're both running on the same machine you may be able to use session_save_path() to resolve this issue.
Personally I wouldn't stay with a host that tried to upsell me a VPS for the sake of a private ip address.
Unfortunately, we have a one year contract w/o a refund And will also require to rewrite the entire site because we are using their templates.
If you are talking about the iframe html workaround, I couldn't get it to work as part of the email message we are receiving using php. Please show me an example.
Originally Posted by tfk11
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)