PRESTASHOP MANIA

FREE PRESTASHOP THEMES & MODULES DOWNLOAD, PRESTASHOP TIPS & TRICKS, PRESTASHOP TROUBLESHOOTING

Prestashop Troubleshoot - Login page keeps appearing on Back office

Written By Mr. D on Monday, February 6, 2012 | 8:24 PM

After you've successfully installed Prestashop on your hosting, some problem might occur. One of the most common problem is some user (admin) always redirect to login page while managing their website on Back office. This is caused by Authorization issue in Prestashop's cookie file. This issue often occurs in Prestashop version 1.4.6.x and has not been fixed in the beta version.

Prestashop Login Page redirect problem

I have some trick to solving this issue, all you have to do is change two lines of your prestashop's cookie file.
That file is located at prestashop/classes/Cookie.php (Prestashop = your public html on cpanel file manager).

Follow This two simple steps:

Step 1
Line 65, try to find this code:
$this->_expire = isset($expire) ? intval($expire) : (time() + 1728000);

change 172800 value into 3600, after you change, it must be like this:
$this->_expire = isset($expire) ? intval($expire) : (time() + 3600);

Step 2
Line 195, try to find this code:
AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))

just add "//" (without quotes of course) exactly before "AND", so it would be like this:
//AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))

Done!
Then save your cookie.php file and try to refresh your browser. Hope you enjoy your time with this awesome CMS. 

If you don't want to edit the coding of the file, you can download the cookie.php file directly from here.
Prestashop Login Page - Cookie.php

20 comments:

Adote Bicho said...

It's not work for me. Anything else possible?

Mr. D said...

have downloaded the cookie.php file?
and what is your prestashop version?

Spotted Sparrow said...

This didn't work for me. Still getting redirect after changing the Cookie.php file.

Christopher said...

Works for me. Thanks for the tip =)

iiMate said...

Thank you !!

I follow your website from here

http://www.prestashop.com/forums/topic/122659-solved-i-cant-login-to-the-back-office-it-redirects-to-login-page/

Art Gabdullin said...

it's strange, but i still have a problem...

http://mylocalmachine/adminvip/login.php?redirect=index.php (shop is intalled on local machine, so link is not working for you)

this is configuration of my local server: http://gabdi.anivers.ru/phpinfo.htm — it's a standart xampp-win32-1.7.7-VC9-installer

i have Win 7 x64, Chrome 18.0.1025.168
prestashop 1.4.7.3 (full mode)

and very intrested moment, it's absolutely no problems on ALL other browsers!! A have tested it on last versions of FireFox, Safari, Opera, IE. Just only with Chome I have a problems...

And proxy is off.

please, help!

WorthtoBuyFromChinaSellers said...

Thank you so much Mr.D! I have solved the problem following your method.

Mr. D said...

you are welcome Kai Weng.. really nice could help ^^

Tre Gatti said...

downloaded cookie.php and still have the problem. Using IE or Mosilla
Installed on localhost. This is well beyond frustrating. Nothing seems to fix this issue.

Wanyun said...

thanks for saving my day!!

Mr. D said...

you are welcome Wanyun

popoy08 said...

Thanks.. it worked well for me.

Unknown said...

Unfortunately it does not work for me. I made the changes and now I get a white screen instead. What am I doing wrong? Thanks for your help.

Unknown said...

It doesn't work for me either.
this issue suddenly appeared today and nothing can fix it apparently.

Unknown said...

I have my Prestashop software installed in localhost and your code did not work. What else can i do?

Thanks,

Unknown said...

Thanks!

Mr. D said...

you're welcome Fatima

@MADC, have follow the exac instructions?

jasa web said...

how about this code?
&& (!isset($this->_content['remote_addr']) || $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))

is it possible to add "//" before && become like this:
//&& (!isset($this->_content['remote_addr']) || $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))

I wanna apply this on prestashop 16.9 thanks for your help. www.jasapembuatanwebblog.com

Unknown said...

I am having the same issue on version 1.7.3.3

Unknown said...

Please let me know the solution I have the same problem for the exact above code.

Post a Comment