Sensei
- Join Date:
- Jan 2004
- Posts:
- 63,513
- Plugin Contributions:
- 176
Can't login to admin
You had quoted beerdawg earlier:> beerdawg:
It seems that logging into the admin pages with zen-cart-1.3.7.1 using PHP-4.3.2 is broken. After entering the correct login/passwd, it will just return back to the login page.
The issue has to do with the call to session_regenerate_id() from zen_session_recreate() in includes/functions/sessions.php (which is called from admin/login.php).
According to the php documentation for php, "Version 4.3.3: Since then, if session cookies are enabled, use of session_regenerate_id() will also submit a new session cookie with the new session id." See the documentation here:
http://us.php.net/manual/en/function.session-regenerate-id.php
That means that 4.3.2 does not submit a new session cookie with the new session id.The fix provided by buraks78 in the comments in the link above seems to address the issue and fix the zen-cart login to the admin page.
Basically, add this directly after the call to session_regenerate_id() in includes/functions/sessions.php:
if(!version_compare(phpversion(),"4.3.3",">=")){
setcookie(
session_name(),
session_id(),
ini_get("session.cookie_lifetime"),
"/"
);
}
>
> Herb.
> **denny1:**
>
> I am having the same login problem.. So do I add this code to the config file? If so which config file?
> ```
if(!version_compare(phpversion(),"4.3.3",">=")){
setcookie(
session_name(),
session_id(),
ini_get("session.cookie_lifetime"),
"/"
);
}
AND/OR
do I use sub-domain to make it all work????
ANY help would be great..
Thanks,
Denny
You could still try it, even though your PHP version is newer than the 4.3.2 issue they mentioned.
Edit the file they mentioned:
/includes/functions/sessions.php
Find the text they mentioned:
session_regenerate_id();
Add the code they mentioned:```
if(!version_compare(phpversion(),"4.3.3",">=")){
setcookie(
session_name(),
session_id(),
ini_get("session.cookie_lifetime"),
"/"
);
}
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.