CodeIgniter Forums

Full Version: Problem deleting cookies
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]codelearn[/eluser]
Hey guys,

I'm having a problem deleting cookies using the CI cookie helper. I'm getting the following error in my error log when I use

Code:
delete_cookie("outreach-score");

Quote:PHP Fatal error: Call to undefined function delete_cookie() in /home/etc/etc

I am loading the cookie helper, so that doesnt seem like the problem.

Thanks!

El Forum

[eluser]ci_user[/eluser]
Having the same issue... any resolution?

El Forum

[eluser]InsiteFX[/eluser]
Try this and see if it works. When deleting cookies the expire time has to be in the pass.
Code:
$expire=time()-60*60*24*30;
setcookie("outreach-scorer", "", $expire);

El Forum

[eluser]ci_user[/eluser]
So I guess there is no way to delete the csrf_cookie since CI sets it?

El Forum

[eluser]InsiteFX[/eluser]
The code above should delete any cookies unless CI is re-setting it.
Make sure you have the correct cookie name.