I would not use this code, it's alot of crap to be honest.
what is the purpose of:
Code:
$successful = true;
if($successful === true){
}
Secondly, javascript should not be used to redirect a user, what happens if they don't have javascript enabled?
A better approach is to use the meta tag.
And lastly
Code:
} else {
show_error_msg(T_("ACCESS_DENIED"), $message, 1);
Will cause a syntax error.