Showing browser and OS details

Discussion in 'Programming' started by Devilfish, Jan 29, 2009.

  1. #1
    Hi folks,

    I have a vBulletin forum and I want to display the browser and operating system in a widget at the side. This would only be displayed to the person viewing the forum, each member would see their own config.

    Does anyone know how I can achieve this please?

    Thanks! :)
     
    Devilfish, Jan 29, 2009 IP
  2. w0tan

    w0tan Peon

    Messages:
    77
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use the $_SERVER['HTTP_USER_AGENT'] variable in PHP to get the info.

    apptools.com/phptools/browser/source.php
    (sorry, can't post links yet)

    See that website if you want to see a good example. You can see, actually getting the browser info is easy, formatting it in a meaningful way is tedious. :)
     
    w0tan, Jan 29, 2009 IP
    Devilfish likes this.
  3. Chuckun

    Chuckun Well-Known Member

    Messages:
    1,161
    Likes Received:
    60
    Best Answers:
    2
    Trophy Points:
    150
    #3
    <?php
    
    echo $_SERVER['HTTP_USER_AGENT'];
    
    ?>
    PHP:
    or

    <?php
    
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
        echo 'Gutted - you use Internet Explorer.';
    }
    
    ?>
    PHP:
    for if you want to whack it into a user-friendly version...

    Obviously you can have a play around with defining multiple browsers on the second one..
     
    Chuckun, Jan 29, 2009 IP
    Devilfish likes this.
  4. Devilfish

    Devilfish Active Member

    Messages:
    396
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Thanks guys, this worked great!
     
    Devilfish, Jan 30, 2009 IP
  5. siothach

    siothach Active Member

    Messages:
    656
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #5
    siothach, Jan 30, 2009 IP
    pitagora likes this.
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    There should be no "gutted" - there are only 2 types of match operator : != and == .. what !== means ?
     
    ActiveFrost, Feb 1, 2009 IP