[Tutorial] - Restricting browser access

Example of PHP code.

Moderator: Moderators

[Tutorial] - Restricting browser access

Postby WinSrev on Sun Nov 27, 2005 10:06 pm

This script restricts access, you have to use Netscape otherwise it will display a message about downloading a new browser.
Code: Select all
<?php
// Recommended browser:
$bname = 'Netscape'; $bdownload = 'http://browser.netscape.com/ns8/';
// Script that gets browser and displays messager
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape') )
    {
      $message = "Your browser is compatiable with our site.";
   }
else
    {
      $message = "If the site does not display correctly it is not compatable with your browser, consider 
               downloading $bname at this url: $bdownload";
   }
echo "$message";
?>
User avatar
WinSrev
Registered User
Registered User
 
Posts: 691
Joined: Sat Nov 27, 2004 10:44 pm
Location: UK

Return to PHP Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest