Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: user privilege script in chap26 professional PHP4


Message #1 by kfo@l... on Tue, 19 Nov 2002 10:38:20
This looks wrong for a couple reasons:

>     case "View Privileges":
>         if ($oUser = $GLOBALS["oUser"]) {
>             displayPrivileges($oUser, getPrivileges());
>         }
>         break;

Notice you've typed just one =.  That means you're making an assignment, not a
comparison.

Also, this code doesn't do anything, really.  It assigns something to itself.

Since the switch statement happens in global scope, $oUser is the same variable
as $GLOBALS['oUser'].


I don't have to book to compare its source, but there's something wrong there.


I also didn't notice that $oUser is being set anywhere.  The line,
"$oUser->getUsername();" is valid code provided that $oUser is an object of the
"user" class.


Take care,

nik


  Return to Index