Trying to set a condition in my header a few questions:
This code is close but gives me an error code and doesn't redirect.
1) Can anyone figure out how to make this work so that if user is in IE6 the url will redirect to the second URL?
2) I would put this in my header right? I can't figure out why this isn't working.
<?php
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
function str_present($str,$substr)
{
$pos = strpos($str,$substr);
if($pos === false) {
return false;
}
else {
return true;
}
}
if (str_present($HTTP_USER_AGENT, "IE6"))
{
header('location: url1');
}else{
header('location: url2');
}
?>