yes, it works, but it isn't specifying a domain, actually setting an expire time or anything of that sort, you only asked if you could check to see if someone has them enabled or not...
and that is what that little script does...checks, if you had them disabled, you would have gotten the other message, cookies are disabled...