Is the user at office or home? 
June 23rd, 2009, 01:31 AM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | |
Hey!
I would like to know if it is possible to know if the user is at home (normal computer), or at office/university or some network.
My idea is to "disable" some features of my site that are not needed if the user is in his work.
Maybe this has something to do with shared IPs, or user behind firewall... I really don't know exactly. Any ideas?
Thanks in advance.
| 
June 23rd, 2009, 10:31 AM
|  | Expert | | Join Date: Mar 2007 Location: England
Posts: 1,063
Provided Answers: 2 | | | re: Is the user at office or home?
You could probably make use of the Predefined variables.
Certainly $_SERVER, and in particular Quote:
PHP Manual
'SERVER_ADDR'
The IP address of the server under which the current script is executing.
'SERVER_NAME'
The name of the server host under which the current script is executing.
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
'REMOTE_HOST'
The Host name from which the user is viewing the current page.
| | 
June 23rd, 2009, 12:28 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
Thanks for your answer, but still, how do I know the IP is shared or not, for example?
| 
June 23rd, 2009, 12:57 PM
|  | Expert | | Join Date: Mar 2007 Location: England
Posts: 1,063
Provided Answers: 2 | | | re: Is the user at office or home?
Well you can't directly.
There are online tools that can help but they are not guaranteed to be right.
If you know the user is using a specific ISP you could get all their IP addresses
into a lookup table and run a search on this
| 
June 23rd, 2009, 01:02 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
Ok cool, thanks a lot :) I will research about this, more!
| 
June 23rd, 2009, 08:25 PM
|  | Expert | | Join Date: Dec 2007 Location: Moon, Dark Side
Posts: 1,075
| | | re: Is the user at office or home? Quote:
Originally Posted by nunoperalta Ok cool, thanks a lot :) I will research about this, more! | I'm curious, what would be an example of a feature you would disable if user is at work vs home?
Why does the physical location matter?
Dan ::devil's adv::
| 
June 23rd, 2009, 08:29 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
Like... the automatic chat with friends?
Like... the automatic selected "Remember Me" option in login?
Too many stuff can be an issue...
| 
June 23rd, 2009, 08:34 PM
|  | Expert | | Join Date: Dec 2007 Location: Moon, Dark Side
Posts: 1,075
| | | re: Is the user at office or home? Quote:
Originally Posted by nunoperalta Like... the automatic chat with friends?
Like... the automatic selected "Remember Me" option in login?
Too many stuff can be an issue... | Again,
why can't they chat with friends automatically at the home or automatically have the Remember Me option from home or anywhere else?
Excuse me, but I fail to see your point and reason to do this.
Dan
| 
June 23rd, 2009, 08:35 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
No.. it's the opposite. At work/public place, "Remember Me" should not be selected by default, right? If the user forgets to logout.....
| 
June 23rd, 2009, 08:47 PM
|  | Expert | | Join Date: Dec 2007 Location: Moon, Dark Side
Posts: 1,075
| | | re: Is the user at office or home? Quote:
Originally Posted by nunoperalta No.. it's the opposite. At work/public place, "Remember Me" should not be selected by default, right? If the user forgets to logout..... | Wouldn't be good for the user to choose where and when they want to store their login and session since most modern browsers have the capability of storing login information?
What if I'm at my uncle's house and I'm using his computer. Would you store my session because I'm in a home? What if I'm at work and I'm the only person who ever has access to this computer?
It's best to leave that alone or treat all user's indiscriminately of location.
The more you control -> the more you'll restrict -> the less user friendly your app will be.
Dan
| 
June 23rd, 2009, 10:22 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
But, I am not forbidding anyone! I am just trying to avoid some problems... I didn't say "remove features", i said "disable by default", but you can enable again if you want...
| 
June 23rd, 2009, 11:24 PM
|  | Expert | | Join Date: Dec 2007 Location: Moon, Dark Side
Posts: 1,075
| | | re: Is the user at office or home?
Automatically selecting a default option is a feature, no? :)
I guess now we've come down to terminology. My point wasn't specific to this exact use of your "Remember Me" feature, but to the underlying concept.
I'll end with the argument that trying to locate where the user is based on network and IP is like guessing they're ethnicity based on location. It's not something that is possible to do accurately, or even significantly reliable, so no one ever does it. It's just not worth the coding time.
more importantly, Have fun!
Dan
| 
June 23rd, 2009, 11:29 PM
|  | Newbie | | Join Date: Jul 2007 Location: Portugal
Posts: 19
| | | re: Is the user at office or home?
It's ok, no problem! I appreciate your opinion :)
Thanks for your time. I will think about this to get the best way to do the things.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,689 network members.
|