Connecting Tech Pros Worldwide Help | Site Map

Is the user at office or home?

  #1  
Old June 23rd, 2009, 01:31 AM
nunoperalta's Avatar
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.
  #2  
Old June 23rd, 2009, 10:31 AM
code green's Avatar
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.
  #3  
Old June 23rd, 2009, 12:28 PM
nunoperalta's Avatar
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?
  #4  
Old June 23rd, 2009, 12:57 PM
code green's Avatar
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
  #5  
Old June 23rd, 2009, 01:02 PM
nunoperalta's Avatar
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!
  #6  
Old June 23rd, 2009, 08:25 PM
dlite922's Avatar
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 View Post
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::
  #7  
Old June 23rd, 2009, 08:29 PM
nunoperalta's Avatar
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...
  #8  
Old June 23rd, 2009, 08:34 PM
dlite922's Avatar
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 View Post
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
  #9  
Old June 23rd, 2009, 08:35 PM
nunoperalta's Avatar
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.....
  #10  
Old June 23rd, 2009, 08:47 PM
dlite922's Avatar
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 View Post
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
  #11  
Old June 23rd, 2009, 10:22 PM
nunoperalta's Avatar
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...
  #12  
Old June 23rd, 2009, 11:24 PM
dlite922's Avatar
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
  #13  
Old June 23rd, 2009, 11:29 PM
nunoperalta's Avatar
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.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve serial number of OS or CPU for copy protection? Klaus Bonadt answers 55 November 17th, 2005 03:26 AM
How do I know if a user has logged on to our LAN BVM answers 7 November 16th, 2005 02:27 PM
How to retrieve serial number of OS or CPU for copy protection? Klaus Bonadt answers 79 September 26th, 2005 05:15 PM
value is null or not an object, but its defined? cwizard answers 16 July 20th, 2005 02:27 PM