Hi, I coded a script and I have started to use it with facebook apps. I want to set cookies while users are using my app. In firefox, cookies are working normally;however, the application do not set cookies in Internet Explorer and users cannot have any restriction. There are my codes using in order to set cookies:

if ( !isset($_COOKIE["$id"]) ) {
    // If the browser is Internet Explorer
    if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) {
       setcookie("$id", $id, time()+864000, "/", ".apps.facebook.com/myapplication");
   // Other browsers
        } else {
             setcookie("$id", $id, time()+864000, "/", ".apps.facebook.com/myapplication");

These ways I have tried and I cannot get a successful result:
=> I used a single code to set cookies(not used an "if" struct)
=> I changed the url with original website url instead of apps.facebook.com/myapplication url

thank you for all answers