| |
PROGRAMMING COURSES
ADMIN VIDEO TUTORIALS
COMMUNITY RESOURCES
|
|
|
Block any Browser You Want |
Programming Category: PHP
Author: Adam Added: Mar 06, 2010 Views: 814 |
 |
We recommend you not block any browser because that is website suicide, but if you must block a crappy browser for whatever reason:
<?php
$agent = $_SERVER['HTTP_USER_AGENT']; // Access what browser they are using
if (preg_match("/\bMSIE\b/i", $agent)) {
echo 'You are using IE, not sweat good buddy, you can pass.';
} else if (preg_match("/\bFirefox\b/i", $agent)) {
echo 'You are using Firefox, you suck, goodbye.'; exit(); // exit the script after telling them they suck for using a crap tool for browsing the web }
?>
To find out the AGENT name for any browser just visit this script yourself while using the browser you wish to block.
<?php
$agentToBlock = $_SERVER['HTTP_USER_AGENT']; // this will be the agent you want to block
echo $agentToBlock;
?>
|
|
|