authenticate only users outside internal ip

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
batty13
Forum Newbie
Posts: 1
Joined: Fri Apr 04, 2008 3:55 pm

authenticate only users outside internal ip

Post by batty13 »

Just need to know if its even possible...

Does anyone know of a way to request login for users outside an internal ip address? I have a client that wants users in the network to be able to access data without a login. (detect ip). However, when they are at home still have access but require them to login.

I know that the best way is to just have them login with email address and pw that they create. However, this client does not want to do things in the standard norm. They insist that the data has to be handled in this way.

I cant think of a way myself as the folder would be set to authenticate, that there is no way around having to login to a secure folder regardless of your ip.

at my wits end.
samb0057
Forum Commoner
Posts: 27
Joined: Wed Mar 26, 2008 9:51 am

Re: authenticate only users outside internal ip

Post by samb0057 »

if (substr($_SERVER['REMOTE_ADDR'], 0, 4) === '127.' or substr($_SERVER['REMOTE_ADDR'], 0, 8) === '192.168.' or substr($_SERVER['REMOTE_ADDR'], 0, 3) === '10.') {
// user is on internal network
}
else {
// require login
}
Post Reply