//bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )
function set_cookie($name, $value = '', $expire = 0, $path = '', $domain = '', $secure = false, $httponly = false)
{
// This function is pointless if we have PHP >= 5.2.
return setcookie($name,
$value,
$expire,
$path,
$domain,
$secure,
$httponly);
// $httponly is the only reason I made this function. If it's not being used, use setcookie().
if (!$httponly)
return setcookie($name,
$value,
$expire,
$path,
$domain,
$secure);
// Ugh, looks like we have to resort to using a manual process.
.
(empty($domain) ?
'' :
'; Domain='.
$domain) .
(empty($expire) ?
'' :
'; Max-Age='.
$expire) .
(empty($path) ?
'' :
'; Path='.
$path) .(!$secure ? '' : '; Secure')
.(!$httponly ? '' : '; HttpOnly'), false);
}