to capture the ip address of the customer and everything worked great.
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.
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
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?
$ipaddy = getRealIpAddr();
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ipaddy=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ipaddy=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ipaddy=$_SERVER['REMOTE_ADDR'];
}
return $ipaddy;
}
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?
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)."
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.
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
I was wondering if Javascript can capture it and send it to php? I was doing a search using javascript and I think I found one that worked. Just don't know how to incorporate it to php which what we already use.
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.
As for javascript... why bother... at that point the address would be so easy to tamper with that I can't see how it would of be of any use.
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.
Originally Posted by tfk11
If that's too much trouble then you may just snag the users ip via http as previously suggested.
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.
Bookmarks