I am generating a PHP error with this function but don't know why.

Little help...

function Validate_Page_Nav($LastPage, $ErrorPage) {

if($_SESSION['Staff_ID']) {
$trimmed = str_replace($staffroot, '', $_SERVER['SCRIPT_NAME']);
$resul = $db->query("SELECT * FROM Page_Access WHERE URI = '$trimmed'") or die("failed to get access data");
$page_access = $resul->fetch_assoc();
$URI_access = explode(",", $page_access['User_Level']);

	if(in_array($_SESSION['Staff_level'], $URI_access)) {
		if($_SESSION['Last_Page'] != $LastPage) {
		header("location: {$ErrorPage}?message=Unable to update user information.");
		exit();
		}
	}
$_SESSION['Last_Page'] = $trimmed;
}

}

Validate_Page_Nav("user_list.php","user_list.php");

Recommended Answers

All 3 Replies

Has your session started correctly before the call to your function? Check by echo'ing $_SESSION["Last_Page"] and make sure it's what you expect.

What error message do you generate?

Has your session started correctly before the call to your function? Check by echo'ing $_SESSION["Last_Page"] and make sure it's what you expect.

What error message do you generate?

The Session is reading correctly.

I am not certain how to display the ERROR. Is there some code I can insert to display PHP errors? All I get is a BLANK white screen.

Sorry for the late reply, I was at work and got distracted doing, well work :P Well your code looks ok to me, could it be that the problem lies in user_list.php with retrieving the $_GET["message"] variable? The only other thing I can think of is that the user level is ok for the access you are trying to attain?

If you don't see error messages in your browser then you aren't actually generating an error, it's just not doing what you want :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.