You are here: header() sometimes fails, sometimes works, same url « All PHP « IT news, forums, messages
header() sometimes fails, sometimes works, same url

Posted by comp.lang.php on 12/07/06 23:39

<?
header('Pragma: no-cache'); // ENSURE CLIENT-SIDE CACHE FLUSHING
$url = "$projectURLPath/index.php";
if ($_REQUEST['logoutMsg']) $url .= '?logoutMsg='.
urlencode($_REQUEST['logoutMsg']);
if ($willAuthenticate && $willUseSSL) {
$dest = 'https://' . $_SERVER['SERVER_NAME'] . $url;
} elseif ($willBasicAuthenticate && $willUseSSL) {
$dest = 'https://EnterYourUserName:EnterPassword@' .
$_SERVER['SERVER_NAME'] . $url;
} elseif ($willAuthenticate) {
$dest = 'http://' . $_SERVER['SERVER_NAME'] . $url;
} elseif ($willBasicAuthenticate) {
$dest = 'http://EnterYourUserName:EnterPassword@' .
$_SERVER['SERVER_NAME'] . $url;
}
header("Location: $dest"); // DEFAULT REDIRECT TO MAIN PAGE
exit();

?>

This code scriptlet will allow for redirection to dynamically relocate
to another URL. However, for some bizarre reason, it will not redirect
anywhere; it just dies (no warnings, no errors, no notices, no
nothing!), however, if you refresh your browser, the redirected page
appears, sometimes after 1, 2, 3 tries. Then sometimes it redirects
with no problems at all.

I tried closing my browser, logging out, refreshing everything,
deleting cache/history.. to no avail.

This only started occurring the moment I used my SessionHandler class
to relocate session files elsewhere due to a business requirement - the
moment I removed SessionHandler, this redirection weirdness occurred
and no amount of debugging seems to be able to solve the problem.

Ideas? Help?

Phil

 

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

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