p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 (http://p2p.wrox.com/forumdisplay.php?f=160)
-   -   Chapter 13, useraccount.php (http://p2p.wrox.com/showthread.php?t=34862)

karlgg November 3rd, 2005 08:55 PM

Chapter 13, useraccount.php
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?


Karlos199 March 13th, 2008 07:27 PM

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.

plugnz February 16th, 2010 04:44 AM

hey there,

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.

plugnz February 16th, 2010 05:06 AM

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????

hmmmm... any thoughts anyone?

plugnz February 16th, 2010 09:23 AM

fixed it - typing error[:I]

All times are GMT -4. The time now is 04:20 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.