Capturing User Date

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
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Capturing User Date

Post by spacebiscuit »

Hi,

I would ike to gather as much user data as possible from users of my site. I know for example that I can capture their IP address, but what other data is available.

Many thanks,

Rob.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Capturing User Date

Post by VladSun »

You may capture all of the data available to javascript objects (especially the window object)
There are 10 types of people in this world, those who understand binary and those who don't
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Capturing User Date

Post by Mark Baker »

robburne wrote:what other data is available.
Take a look at browserspyif you want to see just how much information can be gathered
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Capturing User Date

Post by spacebiscuit »

Many thanks, it does not show how this data can be retrieved though.

I am looking for php specifically.

Thanks,

Rob.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Capturing User Date

Post by John Cartwright »

You could send an ajax request to the server with the relevant javascript information.
User avatar
Attero
Forum Newbie
Posts: 18
Joined: Thu Jan 29, 2009 9:35 am
Location: Farnborough, UK

Re: Capturing User Date

Post by Attero »

To grab the users local time, it's best to use Ajax and send the time from JavaScript to PHP.
Don't keep doing this as it will just be too intensive to handle, so when sending it to PHP, work the difference out between the users time and the servers time and store that.
Then whenever you want to show them their time, simply use a method to add/takeaway the difference (which should be stored in DB).

This means that JavaScript will only be used once per user and will mainly be all PHP based. :)


Also have a look at using get_browser() with the php_browscap.ini file which you can search on google. It's very helpful and will tell you all sorts of things like which browser and version is being used, what operating system is being ran, etc. But beware, the loading times for this function is getting longer and longer as browsers are being updated all the time.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Capturing User Date

Post by VladSun »

If it's only data collecting (i.e. no reply action) you may use simple javascript like this:
[js]var message = 'message to send'; var img = new Image();img.src='http://mysite.com/collector.php?msg=' + message;[/js]

No AJAX used

You may even put

Code: Select all

<noscript><img src='http://mysite.com/collector.php?js=no' style='display:none;'></noscript>
There are 10 types of people in this world, those who understand binary and those who don't
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Capturing User Date

Post by spacebiscuit »

Thanks I will give it a go.

Rob.
Post Reply