Jump to content

Redirect...can someone see something wrong?


cnl83

Recommended Posts

Ok, the page protect function is my class file, but im not sure I have the redirect code right.

[code]

require ('/home/apex/scormsource-www/'."/classes/access_user/access_user_class.php");
session_start();
$sid = $_SESSION['name'];

$page_protect = new Access_user;
$page_protect->access_page(); // only set this this method to protect your page

if (isset($_GET['action']) && $_GET['action'] == "log_out") {
$page_protect->log_out(); // the method to log off
}
//THIS IS WHERE IM HAVING PROBLEMS. IT DOES NOT SEEM TO WORK.
if ($page_protect->access_level >= RESTRICTED_ACCESSPROGRAM_LEVEL)
{
header("location: authenticatedaccessthree.php");
}
//END
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/
Share on other sites

Dont know why...but this worked. Dont know why mine did not work.

if ($page_protect->access_level >= RESTRICTED_ACCESSPROGRAM_LEVEL)
{
//echo $page_protect->access_level;
echo "<script language=\"javascript\" type=\"text/javascript\">";
echo "window.location=\"authenticatedaccessthree.php\";";
echo "</script>";
}
header will only work if it is the first thing you output to the browser.

you can also redirect with
<meta http-equiv="refresh" content="15; url=http://your_url_dot_com" />
15 is the time in seconds before you redirect in case you want to display a message like
"warning you are accessing a page without authorisation the CIA has been warned. This page will self destruct in 15 seconds" (or something similar)

anatak

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.