Karlos Posted May 4, 2009 Posted May 4, 2009 Hey, [*]Firstly, what would be the best way to store OS/browser information in my MySQL database? [*]Secondly, what would be the best way to display the the answer to question one? Quote
Floydian Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information As far as I know, $_SERVER['HTTP_USER_AGENT'] is where you'd find OS and User Agent data for users. For a more automatic deal, you should check out this PHP function: http://us3.php.net/manual/en/function.get-browser.php Quote
Karlos Posted May 4, 2009 Author Posted May 4, 2009 Re: Storing And Reading OS/Browser Information I was looking at that earlier.. But then I was thinking, staff who are not coders/website developers might not understand it. So is there an easy way to select what I want from $_SERVER['HTTP_USER_AGENT']? Quote
Floydian Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Did you check out the page I linked to? Quote
Karlos Posted May 4, 2009 Author Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Yes. I was reading it for a while to think about how I could do it. I also read a few of the user comments and they didn't help very well. Quote
Floydian Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Well if you use their example there, you get an array of data to work with. If you don't know how to work with arrays, you're going to need to study up on PHP 101. Quote
Karlos Posted May 4, 2009 Author Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Warning - while you were typing a new reply has been posted. You may wish to review your post. Actually... I think I have a way.. :-) It uses an array but not get_browser() Quote
Floydian Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information That's what's up. However it works for ya is fine with me ;) Let us know how it turns out Quote
Karlos Posted May 4, 2009 Author Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Well so far without using get_browser() because of php.ini settings.. I get a decent working Browser Detection: Firefox 3.0.10.. But the OS Detection gives a faint idea... like Windows Quote
POG1 Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Try something like this $info = get_browser(); echo 'Browser: '. $info['browser'] .' V'. $info['version'].' '. 'Platform: '.$info['platform']; To check the function return data you could do something like print_r(get_browser()); Quote
Isomerizer Posted May 4, 2009 Posted May 4, 2009 Re: Storing And Reading OS/Browser Information Well so far without using get_browser() because of php.ini settings.. To use this function, you'll need a browscap config file. You can download one here: http://browsers.garykeith.com/stream.as ... rowsCapINI Upload it, then open your php.ini and make sure the path to php_browscap.ini is correct. E.g: browscap = "php_browscap.ini" To test it just try out: $info = get_browser(NULL, TRUE); print_r($info); http://isomerizer.com/index.php?x=browser Quote
Karlos Posted May 5, 2009 Author Posted May 5, 2009 Re: Storing And Reading OS/Browser Information Iso.. I have done what you said but yet... No success... My lines in php.ini: Â The files in the same directory: Â Yet it still errors out (Despite stopping all services (PHP, Apache, ect.)) Quote
Floydian Posted May 5, 2009 Posted May 5, 2009 Re: Storing And Reading OS/Browser Information You are definitely missing the ".ini" on that file name. Quote
Karlos Posted May 5, 2009 Author Posted May 5, 2009 Re: Storing And Reading OS/Browser Information Meh.. That's what I forgot... Thanks Floyd :oops: Quote
Karlos Posted May 5, 2009 Author Posted May 5, 2009 Re: Storing And Reading OS/Browser Information I've replaced the link and tryed the file again again.. With no success. I now currently get no error.. But no information comes up.. :| Quote
Isomerizer Posted May 5, 2009 Posted May 5, 2009 Re: Storing And Reading OS/Browser Information I've replaced the link and tryed the file again again.. With no success. I now currently get no error.. But no information comes up.. :| I got this at first, at least you know it can locate the browscap. You may need to find another browscap config file, however that one worked fine for me. :? Quote
Floydian Posted May 5, 2009 Posted May 5, 2009 Re: Storing And Reading OS/Browser Information What does your script look like? Quote
Karlos Posted May 5, 2009 Author Posted May 5, 2009 Re: Storing And Reading OS/Browser Information I use this file: http://browsers.garykeith.com/stream.as ... rowsCapINI Secondly.. Can anyone tell me if this is correct for them, 3 functions to get the info :lol: http://cursed-islands.com/Bah.php Quote
Floydian Posted May 5, 2009 Posted May 5, 2009 Re: Storing And Reading OS/Browser Information Firefox 3.0.10 Windows Vista That is 100% correct (for me). ;) Quote
Karlos Posted May 6, 2009 Author Posted May 6, 2009 Re: Storing And Reading OS/Browser Information Well due to the edit of php.ini, ect. I found a function to do the Job how I need it. :-P Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.