Jump to content

Archived

This topic is now archived and is closed to further replies.

jomagalo

The IP is not taken to register a new customer

Recommended Posts

I noticed that some clients do not have the IP in its tab. I do not understand why, since some IP if recorded well and others do not. From what I've revised about user.class.php file:

if($_POST['ip_address']=get_ip_address() === false) $_POST['ip_address'] = 'Unknown'; // Get IP Address

added this after line 692

if (!$_POST['ip_address']) $_POST['ip_address'] = $_SERVER['REMOTE_ADDR'];

By this I assure you that takes the IP in your variable. Not sure if it idonea how to fix this, but it works for me.
 
Error detected in CC5.1.4 and CC5.2.2

Share this post


Link to post
Share on other sites

This is my statement:

if($_POST['ip_address']=get_ip_address() === false) $_POST['ip_address'] = 'Unknown'; // Get IP Address

 

get_ip_address() is in the functions file and does a wide variety of methods to discover the IP address.

Share this post


Link to post
Share on other sites

I had to make this change so that the version of PHP I am using on a particular server works:

Was:
if($_POST['ip_address']=get_ip_address() === false) $_POST['ip_address'] = 'Unknown'; // Get IP Address
 
Now:
if(($_POST['ip_address'] = get_ip_address()) === false) $_POST['ip_address'] = 'Unknown'; // Get IP Address

I am guessing that PHP evaluated get_ip_address() === false first, which is false, and assigned that to $_POST['ip_address']. When getting INSERTed into the database, the false is switched to an empty string.

 

Putting parentheses around the first part absolutely assigns the valid IP address to $_POST['ip_address'], then determines if it is false. And if it is false, then uses 'Unknown'.

Share this post


Link to post
Share on other sites

×
×
  • Create New...