|
Posted by Lixas on 01/15/07 18:47
Hi John, I have php function that can be used for users browser
redirection:
<?
function redirect($location, $type="header")
{
if ($type == "header")
{
header("Location: ".$location);
exit;
}
elseif($type == "script")
{
echo "<script
type='text/javascript'>document.location.href='".$location."'</script>\n";
die("redirecting: please <a href=\"$location\">click here</a> if you
are not redirected in 5 sec.");
}
elseif($type == "meta")
{
die("
<html><head><title>Redirecting...</title>
<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=$location\">
</head>
<body>redirecting: please <a href=\"$location\">click here</a> if you
are not redirected in 5 sec</body>
</html>");
}
}
// usage
redirect("www.yourserver.com/yourpage"); //this will use php header
type of redirection
redirect("www.yourserver.com/yourpage", "script") //this will create
javascript with redirections instruction for user and link in case of
JS is turned off
redirect("www.yourserver.com/yourpage", "meta") //this will redirect
your user to your page using meta tags and also creates link to
destination page in case of some kind of error
?>
I think that is all types of redirecting user to other page
Navigation:
[Reply to this message]
|