Hi ppl, long time no see heh. Well the subject speaks for its self. I have a fairly large script which tracks and monitors incoming traffic... its a very sophisticated script, which it doesn't log the same ip over and over, if the same ip does come back it simply tells the database to add 1 to the total visits of that specific ip addr. The problem is that the cookie won't actually set. Heres a short snippet of the code...
if(!isset($_COOKIE["id"])){
if(setcookie("id", "1", time()+3600, "/", "localhost")){
print "Cookie successful.\n";
}
else {
print "Cookie Failed.\n";
}
}
else {
foreach($_COOKIE as $key => $val){
print $key.": ".$val;
}
}
...thats just the part that actually sets the cookie. It does prints "Cookie successful" as you'd expect but when I iterate through the $_COOKIE array the cookie wasnt initially set by setcookie() function, that clearly states that something has gone wrong, but the code looks ok to me. Any suggestions? thx.
PS: One thing, this script works perfectly on my external site. It doesn't work on my computer (http://localhost/). It might be a php.ini issue.