tags:

views:

560

answers:

8

I work for a university, and i'm implementing a PHP web app that needs to have different behavior when it is visited from one certain computer. The problem i am running into is that from the webserver, using $_SERVER['REMOTE_ADDR'] and gethostbyaddr(), i can only identify the router that a computer is going through, and not a specific computername.

Is there anyway i can set that one specific computer to identify itself to the server so the server knows when the webapp is being accessed from that machine? The computer is running firefox in kiosk mode, so addons or greasemonkey scripts are allowed...

+11  A: 

You can set a cookie. This will be remembered by the client and transmitted to the server as part of every request. More information here: http://www.w3schools.com/PHP/php_cookies.asp

MiffTheFox
Just make sure that you understand that cookies can (very easily) be faked...
David Wolever
Unfortunately, if somebody have access to the computer he can stole cookie and set same cookie at other computer.
Dmitriy
@Dmitriy Unfortunately, there's not likely to be any solution that can't be broken by direct physical access to the machine.
ceejayoz
A: 

Don't you have a SessionID ? Your sessionID should be unique enough to identify a computer.

daniel
Not if they close the browser.
ceejayoz
+2  A: 

Some thoughts:

  • Set a durable cookie. (Since FF is in kiosk mode, you should be safe from the users clearing it.)
  • Have that kiosk use a different URL (perhaps with a query string parameter).

What I wouldn't do is work according to the machine's MAC address (which Gibson tells us is possible) or similar; too fragile when hardware gets fixed, etc.

T.J. Crowder
+6  A: 

Change Firefox's user agent header to something that uniquely identifies that machine, you can then extract this string in PHP from $_SERVER['HTTP_USER_AGENT'].

See How to edit the User Agent string

karim79
+3  A: 

How about ssl and client certificates?

http://httpd.apache.org/docs/2.2/ssl/ssl%5Fhowto.html#accesscontrol

VolkerK
+4  A: 

You could set a cookie, or alternatively, you could modify the UserAgent header that your Firefox installation is using to something distinctive.

To change the User Agent string, just enter about:config as an address in the address bar of FireFox, the location where you normally enter a URL (link). I recommend to preserve the original value, which you can get when you enter just about: in the address bar.

Now press the right mouse button to get the context menu and select "String" from the menu entry "New". Enter the preference name "general.useragent.override", without the quotes. Next, enter the new User Agent value you want Mozilla Firefox to use. I added my name and a link to my web site to the original value. You can also pick one from the list of User Agent strings. Check the new value by entering about: in the address bar.

You can retrieve this User-Agent string from $_SERVER['HTTP_USER_AGENT'] in php.

Paul Dixon
A: 

Im sure you got a very good answer but if you are looking for solution that uniquely identifies the COMPUTER rather than the BROWSER then look in to FLASH COOKIES a.k.a FLASH SHARED OBJECTS.

Theses are more powerful and can be used to store data up to 100KB and remains the same across all browsers that has flash, so it is better solution to uniquely identifying a user

A: 

Why not implement an authentication system and place those users who need the special functionality into a special group?

tau-neutrino