Yes, this is nothing too advanced, but I think it's still somewhat useful for websites or programs.
Additionally, you can add a function that writes logged IPs into a text file if you wanna have an IP logger or implement this into a view blocker (which I did for whatever reason).
Yeah so whatever, it's some basic stuff, have fun with this.