Admin Login Create Administrator Not Working

Open to all! Ask other shopowners for help.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Admin Login Create Administrator Not Working

Post by Xpajun »

Had a problem which for some reason did something to my admin login password so decided to remove the old and create a new one...
It no longer works

error log shows the following:

Code: Select all

[11-Jul-2024 18:39:09 UTC] PHP Warning:  Undefined array key "sessiontoken" in /home/*******/public_html/store/includes/system/versioned/1.0.8.1/form.php on line 107
[11-Jul-2024 18:39:09 UTC] PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/*******/public_html/store/includes/system/versioned/1.0.8.1/form.php on line 107

line 107 of form.php in versioned/1.0.8.1 (from 102-110) is:

Code: Select all

    public static function validate_action_is($action = 'process') {
      $requested_action = Request::value('action');
      $formid = $_POST['formid'] ?? $_GET['formid'] ?? null;
      if (is_null($requested_action)
       || is_null($formid)
(L107)       || (strlen($formid) !== strlen($_SESSION['sessiontoken'])))
      {
        return false;
      }

Has this been changed, if so where/when?
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Admin Login Create Administrator Not Working

Post by burt »

I don't think there has been any recent changes in this area, that could affect functionality.

I tested on the 1.09.5 that I am currently working on;

enter admin
delete admin user
- I am automatically logged off with the "create first administrator" change to usual login page
I created an admin user.
I logged in.
Therefore all good.

I did the same steps in a 1.0.9.0;

Same result. All good.

I presume you now have an admin area that you cannot access ?
I am not here to build for you.
I am here to build with you. Let's help each other.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Admin Login Create Administrator Not Working

Post by heatherbell »

Don't know, maybe this helps, wrote it because it helped us once: https://phoenixcart.org/phoenixcartwiki ... n_Password
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Admin Login Create Administrator Not Working

Post by burt »

T o maybe get you out of a sticky situation, you could use phpMyAdmin to insert an admin user;

Code: Select all

admin
$2y$10$m98i86gUTenOupO3Rjlpkuq8SDIvi6AJEghWE3heKu4WEDNvcPPO.
should be;
username: admin
password: pass

You would obviously change that within 5 seconds of logging in.
I am not here to build for you.
I am here to build with you. Let's help each other.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Admin Login Create Administrator Not Working

Post by Xpajun »

burt wrote: Fri Jul 12, 2024 9:34 am T o maybe get you out of a sticky situation, you could use phpMyAdmin to insert an admin user;

Code: Select all

admin
$2y$10$m98i86gUTenOupO3Rjlpkuq8SDIvi6AJEghWE3heKu4WEDNvcPPO.
should be;
username: admin
password: pass

You would obviously change that within 5 seconds of logging in.
Yes you are right - I can't access the admin area

Tried the above and got the same error - it seems to be a php 8.2 problem although it was working up until 3 days ago
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Admin Login Create Administrator Not Working

Post by Xpajun »

Been having a think about this the error:

Code: Select all

[11-Jul-2024 18:39:09 UTC] PHP Warning:  Undefined array key "sessiontoken" in /home/*******/public_html/store/includes/system/versioned/1.0.8.1/form.php on line 107
[11-Jul-2024 18:39:09 UTC] PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/*******/public_html/store/includes/system/versioned/1.0.8.1/form.php on line 107

Am I right in understanding that in line 107 of form.php in versioned/1.0.8.1 :

Code: Select all

    
      || (strlen($formid) !== strlen($_SESSION['sessiontoken'])))
   
   
the sessiontoken (is that the password) is not there causing null to being passed to parameter #1

The question would be why would it not be there?

Nothing has been changed it was all working up until BT changed my IP address which got an auto block to deny me access to my site and after sorting that the login no longer worked
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Admin Login Create Administrator Not Working

Post by ecartz »

Xpajun wrote: Fri Jul 12, 2024 4:39 pm (is that the password)
No. That's the Cross-Site Request Forgery (CSRF) token. I could try to explain the purpose of that in depth, but my past experiences with explaining it to non-developers lead me to believe that it's a lost cause. Non-technically and shallowly, it's the thingie that checks if someone is using Javascript to hijack your admin session.

My quick thought is that I'd try truncating the session table in phpMyAdmin. Since this will mess with both admin and retail sessions, best to do it at a time when not many customers are logged in. Looking at the whos_online table in phpMyAdmin might help with that. When it's empty go ahead and truncate.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Admin Login Create Administrator Not Working

Post by burt »

You might also try it in a different browser, as this would create a new session.
I am not here to build for you.
I am here to build with you. Let's help each other.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Admin Login Create Administrator Not Working

Post by Xpajun »

ecartz wrote: Sat Jul 13, 2024 12:40 am
Xpajun wrote: Fri Jul 12, 2024 4:39 pm (is that the password)
My quick thought is that I'd try truncating the session table in phpMyAdmin. Since this will mess with both admin and retail sessions, best to do it at a time when not many customers are logged in. Looking at the whos_online table in phpMyAdmin might help with that. When it's empty go ahead and truncate.
I've truncated the sessions table and still have the same problem (actually I've truncated it numerous times it doesn't half fill up quick)
burt wrote: Sat Jul 13, 2024 10:02 am You might also try it in a different browser, as this would create a new session.
Have tried this as well - same result - also tried it on my iPad on sim card to bypass my BT IP address with the same result

It is only the admin on my live store that is doing this I can log in to my test store admin with no problem, the only difference was that my test store doesn't have .htpassword (the whole test store is .htpassword protected) so i removed the .htpassword on my live store admin which hasn't made a difference either
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
cbi201214337
Posts: 4
Joined: Tue May 09, 2023 10:22 pm
Phoenix Version: V1.0.9.10

Re: Admin Login Create Administrator Not Working

Post by cbi201214337 »

Hello Xpujun

The same thing happened to me.

I followed the instructions on the following page
https://phoenixcart.org/phoenixcartwiki ... n_Password.

Basically I deleted the admin user from the database with phpmyadmin.

When you enter the administration page, you must create new user and password.

I hope you find this information useful


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply