blm126
08-31-2006, 11:34 PM
I'm having problems with this function to redirect the user.
function redirect($url){
//This is a function to provide a safe and relible redirect
//send a 303 location header
header('Location: '.LINKBASE.$url,true,303);
//die with a click redirect
die('Sorry, you could not be redirected. Please <a href="'.LINKBASE.$url.'">click here</a>');
}
define LINKBASE(this is done before the function is called)
define('LINKBASE','http://localhost/cms/');
it is used here
function checkAuth($level,$url='index.php'){
if(!isset($_SESSION['yes'])){
session_start();
$_SESSION['yes'] = 'yes';
}
if(isset($_SESSION['auth']) && $_SESSION['auth'] <= $level){
return true;
}
else if(isset($_SESSION['auth']) && $_SESSION['auth'] > $level){
return false;
}
else{
redirect($url);
}
}
Whenever I run it Firefox(haven't checked other browsers) issues an error saying
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
I'm sure I'm making some stupid mistake, but I would love to know what it is.
function redirect($url){
//This is a function to provide a safe and relible redirect
//send a 303 location header
header('Location: '.LINKBASE.$url,true,303);
//die with a click redirect
die('Sorry, you could not be redirected. Please <a href="'.LINKBASE.$url.'">click here</a>');
}
define LINKBASE(this is done before the function is called)
define('LINKBASE','http://localhost/cms/');
it is used here
function checkAuth($level,$url='index.php'){
if(!isset($_SESSION['yes'])){
session_start();
$_SESSION['yes'] = 'yes';
}
if(isset($_SESSION['auth']) && $_SESSION['auth'] <= $level){
return true;
}
else if(isset($_SESSION['auth']) && $_SESSION['auth'] > $level){
return false;
}
else{
redirect($url);
}
}
Whenever I run it Firefox(haven't checked other browsers) issues an error saying
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
I'm sure I'm making some stupid mistake, but I would love to know what it is.