Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Need help with IP Address issue on a PHP site, Link click does not return actual IP add

views
     
TSxeNOS
post Mar 8 2019, 01:14 PM, updated 6y ago

.:floccinaucinihilipilification:.
******
Senior Member
1,181 posts

Joined: Nov 2006
Dear All,

I am using HostGator shared hosting with SSL cert installed by HostGator for my site.
I use this site as a file hosting site and provide users with a unique link to download the file.
When user clicks on the link to download the file the site detects the IP address of the user and stores it in a database as a fraud prevention mechanism, but ever since after a recovery from a database connection error the IP address that is returned from the link click does not reflect the actual IP address of the user but instead is always defaulted to my A records IP address.
If I were to manually change the link from https to http then the IP address would be detected correctly but this defeats the initial purpose of getting my site installed with a SSL cert.
Any ideas or solutions ?
Thanks in advance wink.gif
wKkaY
post Mar 11 2019, 01:22 PM

misutā supākoru
Group Icon
VIP
6,008 posts

Joined: Jan 2003
Create a phpinfo() script, access it over https, and search the page for your IP address. Does it show up?
funcode
post Mar 13 2019, 01:00 PM

New Member
*
Newbie
22 posts

Joined: Nov 2018
CODE


function get_wan_ip()
{
   $ip = file_get_contents("http://ipv4bot.whatismyipaddress.com/");

   if(ip2long($ip))
   {
       return $ip;
   }
   else
   {
       return file_get_contents("http://ipv6bot.whatismyipaddress.com/");
   }

}

//example
echo get_wan_ip();

TSxeNOS
post Mar 14 2019, 08:05 PM

.:floccinaucinihilipilification:.
******
Senior Member
1,181 posts

Joined: Nov 2006
Thanks for all the feedbacks! I managed to solved the issue liao! smile.gif
wKkaY
post Mar 15 2019, 02:06 PM

misutā supākoru
Group Icon
VIP
6,008 posts

Joined: Jan 2003
QUOTE(xeNOS @ Mar 14 2019, 08:05 PM)
Thanks for all the feedbacks! I managed to solved the issue liao! smile.gif
*
What was the issue?
turnmoil
post Mar 19 2019, 10:57 AM

Casual
***
Junior Member
420 posts

Joined: Jan 2003
From: The Miau Miaw Niau Miow Land


xeNOS mind to share how u solved it?

 

Change to:
| Lo-Fi Version
0.0119sec    0.44    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 08:42 AM