0

Is it safe to use this code to allow permission to access site?

if(!$_SERVER['REMOTE_ADDR'] == "xxx.xxx.xxx.xxx"){

?

Is it possible to get user Mac address ?

mega6382
  • 9,211
  • 17
  • 48
  • 69
Björn C
  • 3,860
  • 10
  • 46
  • 85
  • 4
    If you're going to do this, use firewall rules rather than application logic. – Phylogenesis Oct 17 '17 at 08:53
  • Sort of depends on *how* secure it needs to be... an IPv4 address can represent an entire network rather than a single user - so it depends on what you're doing. – CD001 Oct 17 '17 at 08:55

1 Answers1

0

Well whats safe? If you do this, you may be able to access your site. But then again, if you do not have a static ip, it wont work for long.

A better solution with php would be to just write a simple login, with non-hardcoded user and pass.

If you run an apache, you could use .htaccess for this too, just set a password and anybody wanting to access your site (if thats what you specify), is required to first type the user/pass combination.

bcBro
  • 46
  • 4