user information?

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
User avatar
AndrewBacca
Forum Commoner
Posts: 62
Joined: Thu Jan 30, 2003 10:03 am
Location: Isle of Wight, UK

user information?

Post by AndrewBacca »

im creating a counter at the moment, but I want to be able to store the os, screen resolution and screen depth of each hit.

is it possible, if so how?

thankyou
Andrew
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Yes, it can be done, but not reliably. You would need a mixture of javascript and PHP. You can get the OS through HTTP_Header in PHP, screen resolution and depth via Javascript.

Off the top of my head:

- have an invisible frame (height=0, widht=0) in which you load a page containing

a) javascript which checks screen resolution and screen depth.
b) a form.

In <body> have onload='checkAndSubmit()', where checkAndSubmit() is the javascript-function which fills in the values into form and the auto-submits the form. That way you have the values available in PHP.

This is, however, unreliable, since some people have Javascript switched off, or some browsers don't support screen-dimension stuff.

Hope that helps.
Post Reply