a Function that is not working...

Reply

Join Date: Jul 2009
Posts: 42
Reputation: dwdata is an unknown quantity at this point 
Solved Threads: 0
dwdata dwdata is offline Offline
Light Poster

a Function that is not working...

 
0
  #1
Nov 5th, 2009
I am generating a PHP error with this function but don't know why.

Little help...

  1.  
  2. function Validate_Page_Nav($LastPage, $ErrorPage) {
  3.  
  4. if($_SESSION['Staff_ID']) {
  5. $trimmed = str_replace($staffroot, '', $_SERVER['SCRIPT_NAME']);
  6. $resul = $db->query("SELECT * FROM Page_Access WHERE URI = '$trimmed'") or die("failed to get access data");
  7. $page_access = $resul->fetch_assoc();
  8. $URI_access = explode(",", $page_access['User_Level']);
  9.  
  10. if(in_array($_SESSION['Staff_level'], $URI_access)) {
  11. if($_SESSION['Last_Page'] != $LastPage) {
  12. header("location: {$ErrorPage}?message=Unable to update user information.");
  13. exit();
  14. }
  15. }
  16. $_SESSION['Last_Page'] = $trimmed;
  17. }
  18.  
  19. }
  20.  
  21. Validate_Page_Nav("user_list.php","user_list.php");
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 811
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Practically a Posting Shark
 
0
  #2
Nov 5th, 2009
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?
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 42
Reputation: dwdata is an unknown quantity at this point 
Solved Threads: 0
dwdata dwdata is offline Offline
Light Poster
 
0
  #3
Nov 5th, 2009
Originally Posted by darkagn View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 811
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Practically a Posting Shark
 
0
  #4
Nov 6th, 2009
Sorry for the late reply, I was at work and got distracted doing, well work 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
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 213 | Replies: 3
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC