cnl83 Posted January 17, 2007 Share Posted January 17, 2007 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 pageif (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 More sharing options...
Eugene Posted January 17, 2007 Share Posted January 17, 2007 @header("Location: authenticatedaccessthree.php");That what you mean? Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163274 Share on other sites More sharing options...
Tandem Posted January 17, 2007 Share Posted January 17, 2007 It looks fine to me. Personally i always have a capital L in Location, but i'm not sure if that makes a difference. Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163276 Share on other sites More sharing options...
cnl83 Posted January 18, 2007 Author Share Posted January 18, 2007 Nah that did not work. Its got to be with my page protect. The page protect works, but not in an if statement obviously. Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163346 Share on other sites More sharing options...
fiat Posted January 18, 2007 Share Posted January 18, 2007 [code]<?php$header = ("location: authenticatedaccessthree.php");@header( $header ); // Redirect browser[/code]try that Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163352 Share on other sites More sharing options...
cnl83 Posted January 18, 2007 Author Share Posted January 18, 2007 That will deffintely redirect, but I need it to rediret if ($page_protect->access_level >= RESTRICTED_ACCESSPROGRAM_LEVEL) Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163372 Share on other sites More sharing options...
fiat Posted January 18, 2007 Share Posted January 18, 2007 it should still work in a if statement. i'd parse the value of RESTRICTED_ACCESSPROGRAM_LEVEL into a $array and try again. Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163409 Share on other sites More sharing options...
cnl83 Posted January 18, 2007 Author Share Posted January 18, 2007 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>";} Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163464 Share on other sites More sharing options...
anatak Posted January 18, 2007 Share Posted January 18, 2007 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 Link to comment https://forums.phpfreaks.com/topic/34646-redirectcan-someone-see-something-wrong/#findComment-163492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.