1

We need to give our website pages access to free users only and only if they are logged in through our Wifi.

Is it possible that we can define such Wifi IP in the admin panel and user connecting through it will only have access to our website pages.

Our website is having paid subscription, so free user can also access the same only if they are connected through my wifi

Please advice

  • 1
    The users conected from the same WiFi will share the same external IP, if it is not dynamic you can set a configuration const with that IP and treat your users diferently. for PHP, see $_SERVER['HTTP_REFERER'] – Carlos Fdev Sep 15 '16 at 08:03

1 Answers1

1

See Carlos Fdev's comment - or in other words: That's not possible.
The Webserver will only receive the IP of the connection the Client used to receive the website. So a Webserver has no chance to gather any other IP used than the one that is used for the web-request.

So you can't get the specific WiFi IP via PHP, but you can check the connection (WiFi) and get the local IP and transmit these values in the web-request:

  1. How do I check connection type (WiFi/LAN/WWAN) using HTML5/JavaScript? Note: The state of this feature is experimental and Mozilla only (in Sep 2016).
  2. Next you can try to retrieve the local IP adress: Can You Get A Users Local LAN IP Address Via JavaScript?.

In your special case maybe it's enough to just check for the local IP adress (without checking for WiFi) if the ip-range of the WiFi is known and does not change.

Community
  • 1
  • 1
SUhrmann
  • 632
  • 1
  • 8
  • 26