Forum Moderators: coopster

Message Too Old, No Replies

How to restrict a user who access the php page from outside office?

         

An156

2:42 pm on Mar 17, 2009 (gmt 0)

10+ Year Member



Hey Everyone, i m working on a project in which whole website shd b accessible to everyone in world but i have to restrict users on a single page when they visit from the outside of the organization. Please guide me

Thanks in advance! :)

whoisgregg

3:10 pm on Mar 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, An156!

You can use the $_SERVER['REMOTE_ADDR'] superglobal to check the visitors IP address. Find out what IP addresses your office uses and then deny or redirect users that don't have that address.

If you want to do a login based system, here's a good thread [webmasterworld.com] from the forum library [webmasterworld.com] that discusses how to do it.

If you start to implement either and run into trouble, post back here with what you've got so far and we'd be happy to help. :)

An156

4:13 pm on Mar 17, 2009 (gmt 0)

10+ Year Member



what if when ip is assign dynamically?

Rosalind

4:26 pm on Mar 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



what if when ip is assign dynamically?

In that case you'll have to use a login system. If you know which range the dynamic IP will be assigned from, you will be able to restrict anyone from logging in outside that range as well, for added security.

An156

4:41 pm on Mar 17, 2009 (gmt 0)

10+ Year Member



hey thanks "whoisgregg" & "Rosalin", your post guided me a lot..
i'll be in touch,
Thanks :)