Re: PHP Beginner question



David Haynes wrote:

<?php
/**
* Module: redirect.inc
*
* Manages a redirection when there may be a session active.
* Also correctly re-addresses URLs that are not absolute.
*
* @param string $url
*/
function redirect($url) {
session_write_close();

if( substr($url, 0, 4) != 'http' ) {
if( isset($_SERVER['HTTP_HOST']) ) {
$url = 'http://'.$_SERVER['HTTP_HOST'].$url;
} else {
$url = 'http://localhost'.$url;
}
}

header("location: $url");
exit;
}
?>

redirect("http_1.1_spec.html");

:-)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

.