<?php
$list = array("tablet browser");
// $list = array("tablet browser", "other", "value");
function searchValues($string, $matchesArray) {
foreach($matchesArray as $currentTest) {
if (strpos(strtolower($string), strtolower($currentTest)) !== false) {
return true;
}
}
return false;
}
$user_agent = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
if (searchValues($user_agent, $list)) {
// ------------------------------------------
// on the tablet
// ------------------------------------------
header( 'Location: /dir/name/file.php' );
} else {
// ------------------------------------------
// not on the tablet
// ------------------------------------------
// Change guest & password to you chosen username & password
if ( $PHP_AUTH_USER != "guest" || $PHP_AUTH_PW != "password" ) {
header('WWW-Authenticate: Basic realm="Protected Area"');
header("HTTP/1.1 401 Unauthorized");
echo "Failed to authenticate.";
exit();
} else {
// ------------------------------------------
// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 3; url=/dir/name/file.php' );
echo "You are logged in successfully as: ".$PHP_AUTH_USER;
echo "</br>";
echo '<h1>You will be re-directed in 3 seconds...</h1>';
}
}
?>
<?php include 'detect.php'; ?>
| The Following User Says Thank You to Khertan For This Useful Post: | ||