Welcome to WebmasterWorld Guest from 54.167.155.147

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Showing login page based on location

   
10:27 pm on May 18, 2010 (gmt 0)

5+ Year Member



Hi all,

A client of our wants a logon page on their website to only appear if a user is using a computer out of the company's network.

Any ideas how this can be done, and if anyone has done it.

cheers
geoffb

[edited by: eelixduppy at 10:31 pm (utc) on May 18, 2010]
[edit reason] no solicitations, please [/edit]

10:39 pm on May 18, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



By "out of the company's network" do you mean outside the company's IP address range? Or do you mean something else? If the former, then just do a check on the user's IP address. If the later, then hwo is "out of the company's network" defined?
11:38 pm on May 18, 2010 (gmt 0)

5+ Year Member



Hi lifeinasia,

Yes outside of the companies network. They don't want internal users to see the login page or even the link to it.

Geoffb
12:02 am on May 19, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



You can use $_SERVER["REMOTE_ADDR"] and check against the range of IP addresses the company uses.

And even nicer implementation (just in case the user is using a proxy) would be:
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$TheIp=$_SERVER['HTTP_X_FORWARDED_FOR'];
else $TheIp=$_SERVER['REMOTE_ADDR'];
7:41 am on May 19, 2010 (gmt 0)

5+ Year Member



Thanks. How is that converted into hiding a logon div panel if the user is within the companies ip range?
Geoffb
3:18 pm on May 19, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



You check the user's IP against the company's range. If it's in the range, you don't show the logon panel.
3:26 pm on May 19, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



if you cant do IPs, then you can give all the browsers in the building their own user_agent, and check that instead... assuming that the company has control over the browsers.

its a five-second job with firefox. never tried with IE.