note 74653 added to function.header
| From: | CraigFrancis at osu1 dot php dot net | Date: | Sat, 21 Apr 2007 20:10:49 +0000 |
| Subject: | note 74653 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125760@lists.php.net to get a copy of this message | ||
If you want to send a user onto a new page, using a redirect, then you can use the following.
It takes care of a bug in Internet Explorer when directing from an HTTPS to an HTTP page, and also
provides a link to any other user agents which do not understand the 'Location' header.
<?php
function goto($goto) {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
if (preg_match('/http:\/\//', $goto)) {
header('Refresh: 0; URL=' . $goto);
exit('<p><a href="' . htmlentities($goto) .
'">Loading...</a></p>');
}
}
header('Location: ' . $goto);
exit('<p>Goto <a href="' . htmlentities($goto) . '">next
page</a></p>');
}
?>
http://www.craigfrancis.co.uk/features/code/phpRedirect/
----
Server IP: 69.147.83.197
Probable Submitter: 82.32.88.140
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/74653
Del: integrated -- https://master.php.net/note/delete/74653/integrated
Del: useless -- https://master.php.net/note/delete/74653/useless
Del: bad code -- https://master.php.net/note/delete/74653/bad+code
Del: spam -- https://master.php.net/note/delete/74653/spam
Del: non-english -- https://master.php.net/note/delete/74653/non-english
Del: in docs -- https://master.php.net/note/delete/74653/in+docs
Del: other reasons-- https://master.php.net/note/delete/74653
Reject -- https://master.php.net/note/reject/74653
Search -- https://master.php.net/manage/user-notes.php