Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    [closed] Get Users Browser Details

    Hello, my friend told me that you can get a users Browser Details, but I can't seem to find a script anywhere.

    I would like to have it tell me what browser they are using, their ISP, their browser plugins, their city/state.

    Please let me know, thanks.



    LOL I FOUND IT! $_SERVER['HTTP_USER_AGENT'] Thanks anyway!
    Last edited by markman641; 08-09-2012 at 05:59 AM.

  • #2
    New Coder
    Join Date
    Aug 2010
    Location
    myeik
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 5 Posts
    Code:
    <?php
    $server = $_SERVER['HTTP_USER_AGENT'] ;
    echo $server;
    echo "<br/>";
     
    
    //echo "<br/>";
    echo "<script type = \"text/javascript\">document.write(navigator.userAgent);</script>";
    ?>
    or
    Code:
    <?php
    
    $ip = $_SERVER['REMOTE_ADDR'];
    $referer = $_SERVER['HTTP_REFERER'];
    $date = date('r');
    $status = "Your IP is <i>$ip</i> <br />\n";
    
    function agent($browser) {
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    return strstr($useragent, $browser);
    }
    
    function os($opersys) {
    $oper = $_SERVER['HTTP_USER_AGENT'];
    return strstr($oper, $opersys);
    }
    
    if(agent('Firefox') != FALSE) {
    	$status .= "You are using <i>Firefox browser</i> <br />\n";
    	
    	  if(os('Windows') != FALSE) {
    	$status .= "You are on <i>Windows</i> <br />\n";
    	}
    	  elseif(os('Linux') != FALSE) {
    	$status .= "You are on <i>Linux</i> <br />\n";
    	}
    	  elseif(os('MAC') != FALSE) {
    	$status .= "You are on <i>MAC OSX</i> <br />\n";
    	}
    	  else {
    	$status .= "Operating system not recognised <br />\n";
    	}
    	
    }
    
    else if(agent('America Online Browser') != FALSE) {
    	$status .= "You are using <i>AOL browser</i> <br />\n";
    	$staus .= "You are on <i>Windows</i> <br />\n";
    }
    
    else if(agent('Opera') != FALSE) {
    	$status .= "You are using <i>Opera browser</i> <br />\n";
    	
    	  if(os('Windows') != FALSE) {
    	$status .= "You are on <i>Windows</i> <br />\n";
    	}
    	  elseif(os('Linux') != FALSE) {
    	$status .= "You are on <i>Linux</i> <br />\n";
    	}
    	  elseif(os('MAC') != FALSE) {
    	$status .= "You are on <i>MAC OSX</i> <br />\n";
    	}
    	  else {
    	$status .= "Operating system not recognised <br />\n";
    	}
    	
    }
    
    else if(agent('Safari') != FALSE) {
    	$status .= "You are using <i>Safari browser</i> <br />\n";
    	$status .= "You are on <i>Linux</i> <br />\n";
    }
    
    else if(agent('MSIE') != FALSE) { 
    	$status .= "You are using <i>Internet Explorer</i> <br />\n";
    	$status .= "You are on <i>Windows</i> <br />\n";	
    }
    
    else { 
    	$status .= "User Agent not recognised. <br />\n";
    	
    		if(os('Windows') != FALSE) {
    	$status .= "You are on <i>Windows</i> <br />\n";
    	}
    	  elseif(os('Linux') != FALSE) {
    	$status .= "You are on <i>Linux</i> <br />\n";
    	}
    	  elseif(os('MAC') != FALSE) {
    	$status .= "You are on <i>MAC OSX</i> <br />\n";
    	}
    	  else {
    	$status .= "Operating system not recognised <br />\n";
    	}
    	
    }
    
    if(!empty($referer)) {
    preg_match('/http:\/\/(.+)(.com\/|.net\/|.org\/|.co.uk\/|.info\/)/', $referer, $referersite);
    $status .= "You found this page from <i>$referersite[0]</i> <br />\n";
    }
    
    $status .= "Date data logged <i>$date</i>";
    
    print $status;
    
    ?>
    i don't konw other method friend ,
    Thanks

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,089
    Thanks
    15
    Thanked 246 Times in 246 Posts
    Much better than stuppy javascript methods.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •