How do I cloak based on the browser? For example, if visitor is running IE execute this code else execute another Thanks Ithilnet
if (stripos('msie', $_SERVER['HTTP_USER_AGENT']) !== false) { // IE } else { // Everything else unless you wanna be more specific } PHP: I think
<?php function _get_browser() { $browser = array ( //reversed array "OPERA", "MSIE", // parent "NETSCAPE", "FIREFOX", "SAFARI", "KONQUEROR", "INTERNETSEER" ); $info[browser] = "OTHER"; foreach ($browser as $parent) { if ( ($s = strpos(strtoupper($_SERVER['HTTP_USER_AGENT']), $parent)) !== FALSE ) { $f = $s + strlen($parent); $version = substr($_SERVER['HTTP_USER_AGENT'], $f, 5); $version = preg_replace('/[^0-9,.]/','',$version); $info[browser] = $parent; $info[version] = $version; break; // first match wins } } return $info; } $info=_get_browser(); $browser=$info[browser]; ?> PHP: That returns on variable $browser very friendly value and "MSIE" is Internet Explorer Cheers, Venetsian
Keep in mind that anybody can fake his useragent so it is not to trust 100% for security / sensitive stuff
If he needs to cloak that's good, but if you're trying to do SEO Cloaking then better use IP lists .. otherwise you can get banned so badly ... Cheers, Venetsian.
Naa it isn't for search engine cloaking. I have a site that has troubles with IE and the css style and I need to display another design. Thank you very much!