The AppGini function CreatorIP does not give me the correct IP number format. But like this
2003:c0:ff29:ff00:71ba:3b70:d709:7a70
Database is UTF8. I have also tested other formats.
Does anyone have an idea what the problem is?
Thank you, Kai
CeratorIP Format
Re: CeratorIP Format
That IP looks like a normal IP v6 (https://en.wikipedia.org/wiki/IPv6_address). So I guess the function (parseCode in incCommon.php) still works correctly and there is no problem with the code.... 2003:c0:ff29:ff00:71ba:3b70:d709:7a70 ...
You can check your IP in PHP by yourself:
Code: Select all
$ip = $_SERVER['REMOTE_ADDR'];
I have written an article in March 2020 about storing the string representation of IP-addresses, both, IP-v4 and IP-v6, in relational databases:
https://appgini.bizzworxx.de/appgini/da ... databases/
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: CeratorIP Format
Hi Jan, thank you for the answer. I have looked at your page.
Is there a way to store the IP number in a numeric format in the database? So that on the page the field is displayed as e.g. 192.168.0.1 ?
Thanks a lot!
Is there a way to store the IP number in a numeric format in the database? So that on the page the field is displayed as e.g. 192.168.0.1 ?
Thanks a lot!
Re: CeratorIP Format
Well, of course you can convert each hexadecimal fragment of an IPv6 address into a numeric (integer) value and store 8 (or more) integers in the database, but this will not make any sense for various reasons.Is there a way to store the IP number in a numeric format in the database?
--
Excerpt from wikipedia:
--An IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits (two octets, a group sometimes also called a hextet[6][7]). The groups are separated by colons (:). An example of an IPv6 address is:Code: Select all
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Obviously, 8 (or more) integers, converted from hex (IPv6), can never be stored in 4 bytes (IPv4) without data loss. It is like putting a trillion big elephants into 4 too small dog-houses.
No, you cannot convert every possible IPv6 addresses into a 4-byte-IPv4 representation without data loss.So that on the page the field is displayed as e.g. 192.168.0.1 ?
The major reason why IPv6 was invented years ago was that IPv4 range is much too small for all publicly addressable devices in the world today. There may be hacks for looking up matching IPv4 addresses within a Local Area Network but this will probably never work for addresses outside a given subnet.
So, we all have to get used to the fact that an IP address no longer looks like it did in the 1990s
IPv6 is a valid IP address representation. If you want to store the IP-address, just store the IP address
PS: There is no place like 127.0.0.1
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: CeratorIP Format
Hi Jan,
thank you for the effort to give me such a detailed answer.
I think I'll just leave out the ip in my audit log
Many greetings, Kai
thank you for the effort to give me such a detailed answer.
I think I'll just leave out the ip in my audit log
Many greetings, Kai