This is the code that I'm using which forces cookies to expire after 90 days:
setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60);
If I want the cookie to never be set to expire, what would I need to change this line to?
This is the code that I'm using which forces cookies to expire after 90 days:
setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60);
If I want the cookie to never be set to expire, what would I need to change this line to?
How about
$year = 365*86400;
setcookie("WHMCSAffiliateID", $aff, time()+100*$year);
?
100 years is a bit much obviously. 2 years should be fine. Or 1. Or 10 if you have to be absolutely sure and never change your code.
It is not possible to set a cookie to never expire. However, if you renew cookies periodically then they can effectively live forever.
Personally, I like to set cookies for 30 days, and renew them every so often. One way of doing this might be:
setcookie("WHMCSAffiliateID",$add,time()+30*24*60*60);
setcookie("Renew-cookies","1",time()+10*24*60*60);
Then on every pageload:
if( isset($_COOKIE['WHMCSAffiliateID']) && !isset($_COOKIE['Renew-cookies'])) {
setcookie("WHMCSAffiliateID",$_COOKIE['WHMCSAffiliateID'],time()+30*24*60*60);
setcookie("Renew-cookies","1",time()+10*24*60*60);
}