#1 2024-11-03 18:08:53

OHappyDay
Member
2023-02-08
98

History in IP addresses

Hello/Hi/Greetings,

since the update to 15.0.0 the size of the IP field in the history table (piwigo_history) has been increased to 39 characters. Nevertheless the IPv6 addresses saved are still truncated to 15 characters.

Is there a missing update in some .php file that truncates the IPv6 address to 15 characters before saving it to the database?

Thanks

Offline

 

#2 2024-11-04 15:00:44

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13877

Re: History in IP addresses

That's perfectly right. I forgot to remove a piece of code! Can you test a change and tell me if it works fine?

In your file include/functions.inc.php line 471 and 473 change "15" for "39".

Code:

  $ip = $_SERVER['REMOTE_ADDR'];
  // In case of "too long" ipv6 address, we take only the 15 first chars.
  //
  // It would be "cleaner" to increase length of history.IP to 50 chars, but
  // the alter table is very long on such a big table. We should plan this
  // for a future version, once history table is kept "smaller".
  if (strpos($ip,':') !== false and strlen($ip) > 15)
  {
    $ip = substr($ip, 0, 15);
  }

Offline

 

#3 2024-11-04 18:00:21

OHappyDay
Member
2023-02-08
98

Re: History in IP addresses

Thanks, that piece what I was looking for but could find it.

After the change the IPv6 addresses are now saved completely.

Thanks, I guess the change will go to the next minor update of piwigo.

Klaus

Offline

 

#4 2024-11-04 18:07:50

OHappyDay
Member
2023-02-08
98

Re: History in IP addresses

n.b. please change also the comment mentioning the truncation to 15 characters, now 39 characters.

Offline

 

#5 2024-11-04 20:04:32

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13877

Re: History in IP addresses

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact