monkeytooth Posted July 10, 2008 Share Posted July 10, 2008 Hey all whats up lets see if anyone can help me or point me in the right direction on this. Im trying to make my own little custom app for a bulk of my sites. I know there are premade scripts for this stuff but Im not interested in the premade, well the lazy side of me is.. but that said.. I have been trying to google around looking to find out what the full scope of what php can get me as far as browser types and system info I can get from a visitor on my site, and outside of the norm is there any other general info I can obtain about a user who visits the site that may be of use? Does anyone have a generalize or full on list of what info I can obtain.. and if its outside the norm, how about i can go about using php to obtain such info.. Its nothing malisious its mostly cause I am working on a site for one of the unglorious 50 united states.. and it has been made known that the main site I am working on they want any and all possible statistics.. demographs.. what ever you wanna call it I dont knowwhy they would want to know anything and everything but they do.. lol, so any help would be greatly appreciated.. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/ Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 You can collect the browser info and IP, then you can also use GeoIP for an approximate location. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586878 Share on other sites More sharing options...
monkeytooth Posted July 10, 2008 Author Share Posted July 10, 2008 what about system info, anything like resolution, os, etc? anyone know what kind of stuff along those lines I can collect.. good call on the geoIP thing would have never thought about that. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586880 Share on other sites More sharing options...
lvtrii Posted July 10, 2008 Share Posted July 10, 2008 PHP Isn't too good at collecting demographics (bar things like IP, user agent string [which people can change...]) I'd look into using javascript along with xmlhttprequest to post data back to your server (with a lot of error checking, seen as people can also post nonsense data to that page). Javascript will allow you to detect user resolution etc, whereas PHP won't. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586885 Share on other sites More sharing options...
monkeytooth Posted July 10, 2008 Author Share Posted July 10, 2008 was hoping to avoid java as much as possible.. but if that be the case i suppose im gonna have to, But thank you, if anyone has any other concepts by all means post it here.. i got this post set on notify :-) Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586889 Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 First of all, it's Javascript, not Java. There's a huge difference. And PHP can't collect too much CLIENT info from the SERVER side. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586892 Share on other sites More sharing options...
lvtrii Posted July 10, 2008 Share Posted July 10, 2008 Java and Javascript are two completely different things. Javascript is really your only option for things like screen resolution, as that information is never passed to the server, so PHP can't access it. For things like IP, OS and what browser they're using, php is fine Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586893 Share on other sites More sharing options...
monkeytooth Posted July 10, 2008 Author Share Posted July 10, 2008 Would you have any examples of Javasccript/Java that would get me extra info? Or any good refrences that I can read through.. Im not to well versed with java/javascript.. as I said i try to when and if possible avoid the use, as people could simply turn it off and negate the use of its being there.. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586899 Share on other sites More sharing options...
lvtrii Posted July 10, 2008 Share Posted July 10, 2008 Firstly, it's Javascript. Make sure to get Java out of your head or you'll get quite confused when using google.. As for the simplest way to detect a user's screen resolution and post it back to a server using javascript: var sWidth = screen.width; var sHeight = screen.height; var xmlhttp=false; /* Try IE */ try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } /* Try firefox */ if (!xmlhttp) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } if (xmlhttp){ var data = "w=" + sWidth + "&h=" + sHeight; xmlhttp.open("POST", "page-on-server.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(data); } Personally, I use jQuery for all my javascript now. It's so much nicer than using the original code. Link to comment https://forums.phpfreaks.com/topic/114160-browser-system-user-stats-and-demographs/#findComment-586914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.