Why Does CodeIgniter Set Cookie Not Work?

Well, because CodeIgniter is garbage, and you should probably be using Yii.

If you want to fix CodeIgniter, open up system/core/Input.php and scroll down to line 248 to see this line:

$expire = time() - 86500;

Well that's silly ... someone decided to set the cookie's expiration date to yesterday!

If you change the '-' to a '+', your cookies will be good for 24 hours. If you want your cookie to be good for 40+ years, try this:

$expire = time() * 2;

This bug may have been fixed in later versions, but it certainly was not in mine.


2 comments:

  1. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
    First Canadian Aligning R&D for SR&ED Tax Credits

    ReplyDelete
  2. CodeIgniter is gaining popularity these days. It is easier, faster and more reliable as compared to other frameworks. Kanhasoft is leading CodeIgniter Development Company in India which has successfully completed many Customized CodeIgniter Application Development projects. Visit our site.

    ReplyDelete