SHOWING BROWSER INFO

 

Showing a users browser info is a common trick used on many websites to make their users feel more at home. This is extremely easy to accomplish, in fact it only takes one step.

All we need to do is open the page where we want to display the users browser info. Make sure that its extension is .php and not .html or anything else. Now find where we want to show the browser info and insert the following code there:

<?
$browser = "$HTTP_USER_AGENT";
print("Browser Info: $browser")
?>

This will show the user the following: Browser Info: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; YPC 3.2.0)

If we wanted to add some customization we can always do this inside the print tag. For example why don't we take the text Browser Info and add some color to it.
print("<font color=\"red\">Browser Info: $browser <font>")
Now we have some color added into the browser info, you are free to play around with anything inside the print() tag, however don't forget that you must insert a backslash (/) before any " when adding HTML into PHP, otherwise PHP will get confused between the " for the HTML code and its own.

 

Hosted by www.Geocities.ws

1