New to PHP new to programming. Have bought a brief introduction to the subject & have been fascinated & impressed by the possibilities & versatility of the code.
My problem.
Having been choughed by some early experiments in using getenv & preg_match functions to identify a browser, how would I be able to automatically redirect a browser to the corresponding browser page?
I have set out below my most recent attempt, which no doubt is most lamentable but if anyone could “hold my hand” on this one & explain basically where I’m going wrong I would most appreciate it.
<?
$agent = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$agent")) {
header ("Location: = http://www.My IE6 site");
exit;
}
?>
Thank you very much for any assistance
JD
(London)
Creating a custom browser redirection script
Moderator: General Moderators
are you sure it's set in the enviroment?
Try instead $_SERVER['HTTP_USER_AGENT'] (or $HTTP_SERVER_VARS php.version < 4.1.0) and have a look at get_browser
Try instead $_SERVER['HTTP_USER_AGENT'] (or $HTTP_SERVER_VARS php.version < 4.1.0) and have a look at get_browser