note 74653 deleted from function.header by nlopess

From: Date: Tue, 01 May 2007 13:40:08 +0000
Subject: note 74653 deleted from function.header by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126045@lists.php.net to get a copy of this message
Note Submitter: Craig Francis ---- 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/

« previous php.notes (#126045) next »