I am trying to set a cookie with the following code from an external script but for some reason When I try to read the cookie from Javascript or php it never shows the information that I inserted, it only shows the Modx cookie information. What am I missing?
$modx = new modX();
$modx->initialize('web');
$_SESSION["username"] = $_POST["username"];
$_SESSION["member_num"] = $result["member_num"];
setcookie("member_num", $result["member_num"], time()+3600);