Forums / Developer / Help: Admin is not allowed

Help: Admin is not allowed

Author Message

lin vin

Thursday 20 May 2004 6:48:52 pm

Hello all:
I have met a intractable problem. This happened when I trid to login the "user/fogetpassword" after I have logon with "admin". However I canceled to email. Then the problem appeared: I cant login using "admin", while i can login with other IDs.
I looked into the code "kernel/classed/datatypes/ezuser/ezuer.php", and found that it coundn't get any user with the name of "admin". I found that the status of user "admin" in the database of "ezcontentobject" have changed to "2", so i changed it to "1". Then it can return an ezuser of "admin".
However, I cant login using "admin" either.Then I debug, and it prints
"Warning: eZCodePage May 21 2004 09:50:48
Couldn't load codepage file share/codepages/utf-8
"
I can login with other IDs, but when i login with "admin", none of the pages is allowed.It just like the "admin" is uneable, but "enable" of the table "ezuser_setting" is "1". I think that the database has changed when i click "user/forgetpassword".However, I have no idea how to solve it.
I hope i can get the way from here. Thanks

Dominik Pich

Friday 21 May 2004 1:31:13 am

        $user =& eZUser::fetch( $forgotPasswdObj->attribute( 'user_id' ) );
        $email = $user->attribute( 'email' );

        $ini =& eZINI::instance();
        $passwordLength = $ini->variable( "UserSettings", "GeneratePasswordLength" );
        $password = eZUser::createPassword( $passwordLength );
        $passwordConfirm = $password;

        $userToSendEmail =& $user;
        $user->setInformation( $user->id(), $user->attribute( 'login' ), $email, $password, $passwordConfirm );
        $user->store();

It changed the password of the admin - set a new one you know

lin vin

Saturday 22 May 2004 9:01:11 am

Thank you for your reply!
But when i fetch the ezuser by id as following:

$user =& eZUser::fetch( 14 );//14 is the id of admin

I cant fetch any user.

lin vin

Saturday 22 May 2004 9:37:11 am

I got it!!
The db is not connected.I add the codes:

$db =& eZDB::instance();
$db->connect("localhost",$the_database,"root","");

However,it cant get any user, because the $connection in "lib/classes/ezdb/ezmysqldb.php" is false.Then i change the code:
$result =& mysql_query( $sql, $connection );
to
$result =& mysql_query( $sql);

Then i got it.
But I think it is not the best way.