You are here: Re: PHP Redirect « PHP Programming Language « IT news, forums, messages
Re: PHP Redirect

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация