944,026 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 413
  • PHP RSS
Nov 5th, 2009
0

a Function that is not working...

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

Little help...

PHP Syntax (Toggle Plain Text)
  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");
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
dwdata is offline Offline
44 posts
since Jul 2009
Nov 5th, 2009
0
Re: a Function that is not working...
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?
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Nov 5th, 2009
0
Re: a Function that is not working...
Click to Expand / Collapse  Quote originally posted by darkagn ...
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.
Reputation Points: 10
Solved Threads: 0
Light Poster
dwdata is offline Offline
44 posts
since Jul 2009
Nov 6th, 2009
0
Re: a Function that is not working...
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
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Please Help Me Fix My PHP Register Form
Next Thread in PHP Forum Timeline: Stamp text on an image.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC