|XP is just a number
I've been down this road before, see my post COOKIE HELL or something like that...anyway what was suggested in the first reply is almost certainly your problem.
Ya gotta set the cookie before any header goes out, it's got to be the first thing you do else you'll never get it to set. When I was working on getting mine to set, I would invoke a new script just so I was certain there would be no header set when I stuck it in.
"Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein