DEV Community

Discussion on: Block a List of IP Addresses in PHP

Collapse
 
moopet profile image
Ben Sinclair • Edited

You might want to add some other $_SERVER keys there, like X_FORWARDED_FOR off the top of my head, depending on whether things are going through proxies, etc.

Also, just remembered, these values can be comma-separated lists (depending on hosting), like "123.123.123.123,101.101.101.101" so you should explode() them and loop through their values.

Collapse
 
natclark profile image
Nathan

All good points - this is a more primitive solution as it stands, and I should probably at least mention how you can start implementing things like proxy detection.