Per identificare il browser che l'utente sta usando..
<?
echo "Your browser is: $HTTP_USER_AGENT<br><br>\n";
// MSIE 4 or 5?
if(eregi("msie.[4|5]",$HTTP_USER_AGENT))
$browser = "msie";
// Netscape Navigator?
else if(eregi("nav",$HTTP_USER_AGENT))
$browser = "nav";
else
$browser = "other";
if($browser == "msie")
if(date("z") > 350)
{
echo "It is almost Christmas<br><br>\n";
echo "phtml.com uses /css/msiexmas.css for your browser<br><br>\n";
}
else
{
echo "phtml.com uses /css/msie.css for your browser<br><br>\n";
}
else
{
// is it almost christmas?
if(date("z") > 350)
{
echo "It is almost Christmas<br><br>\n";
echo "phtml.com uses /css/otherxmas.css for your browser<br><br>\n";
}
else
{
echo "phtml.com uses /css/other.css for your browser<br><br>\n";
}
}
// select which bookmark code to display
echo "and uses this bookmark code:<br>\n";
if($browser == "msie")
{
echo "<span style='color:blue;cursor:hand;'
onclick='window.external.AddFavorite(\"http://phtml.com/\", \"phtml.com
- Free PHP Scripts\");'>Click here to bookmark phtml.com</span>";
}
elseif($browser == "nav")
echo "Bookmark phtml.com (Press CTRL+D)";
else
echo "Don't forget to bookmark phtml.com";
?>
![]()
![]()