Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting a cookie
@ak5

This comment has been minimized.

Copy link

commented Mar 1, 2016

this will set the expiry date 1 month past the epoch.

I believe you forgot a time() call in the 3rd param like so:

setcookie( $v_username, $v_value, time() + 30 * DAYS_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
@RexAK

This comment has been minimized.

Copy link

commented May 9, 2017

Additionally, the constant is singular: DAY_IN_SECONDS <----correct vs. DAYS_IN_SECONDS <---- incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.