Welcome Page with HTTP_USER_AGENT : HTTP_USER_AGENT « HTML « PHP






Welcome Page with HTTP_USER_AGENT

 
<html>

 <head>
  <title>Welcome Page</title>
 </head>
 
 <body>
 <center>

 <?php

  $browser = $_SERVER['HTTP_USER_AGENT'];

  if( preg_match( "/Pixo/i", "$browser" ) )
  {
    $img = "<img src=\"small-tux.gif\" ";
    $img.= "width=\"64\" height=\"75\" ";
    $img.= " alt=\"tux\" >";
  }
  else
  {
    $img = "<img src=\"large-tux.gif\" ";
    $img.= " width=\"320\" height=\"375\" ";
    $img.= " alt=\"tux\" >";
  }
  echo( $img );
 ?>
    
 </center>
 </body>

</html>
  
  








Related examples in the same category

1.Browser Detection
2.Browser content
3.Determining client operating system and browser
4.Get Browser and Platform
5.Reporting the User Agent and Referrer