This Function Has Been Available Since:|
(AFCommerce v 2.1, Functions v 1.1)
string = afc_get_domain_name_for_cookie ()
This function returns the domain name of your website in a format for setting a cookie. When setting a cookie, the domain name should be only a second level domain (sld), i.e. afcommerce, and a third level domain (tld), i.e .com. The cookie domain also has another period added to the beginning of it so that the cookie value will be available on all sub domains of your website. This function may be called directly inside the "setcookie" php function to avoid unnecessary coding, and will always figure out which domain name your website is using by checking the SERVER super global array variable.
There are no parameters for this function.
Returns the domain name formatted for setting a cookie.
Open Source: Yes
setcookie("cookiename", "1", time()+3600, "/", afc_get_domain_name_for_cookie (), 0);
Back to Functions List