You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
There seems to be a problem with the Modify Account function, in useraccount.php ... When you create an account, and modify the access level with an Administrator, the "Full Name" field is filled with your Admin's name field, instead of the account you're modifying. Therefore, if you change the access level and save it, you will change the new account's name to match your admin account!
What's worse, the screenshot in the book (page 456) shows this happening, the user "George Smith" gets modified, and "admin" is displayed in the edit box.
Changing the $name inside useraccount.php (I used $uname) fixes the functionality for it, but why is it happening? If there's a conflict with a global variable, why isn't the DB read overwriting YOUR logged-in-as name, instead of the other way around?
I ran into this same problem. From what I can tell, the $name variable gets set correctly, but when the require_once 'header.php' is issued after setting the variables, it releases $name for some reason.
Moving require_once 'header.php' to the top of the file (line 3) solved my problem.
Even weirder- I have had the useraccount.php working fine until I tried to set up the admin page! The first time I tried to modify a users details in the administrators login I ended up with that users name as the logged in name and since then once logged out any user that is logged in again it wont show any user name - till I try to modify a user acount then end up with that users name again..... I'm using Xampp with apache 2.4.14 AND PHP 5.3.1 on windows. Have checked php.ini and register globals is st to off. I've always had the $name changed to $username anyway and tried moving include header to the top as suggested above.....but alas still the same prrblem. I have to say I have modified the script from the book to fit into my own site so will now see if the same thing occurs using the code straight from the book.
ok, heres the rub... working fine in the book version.. but my code which is obviously very wrong i get this message...
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
as i said before register globals is off... does that mean it should be on? considering im using php 5.3.1????