Curl cookiejar line commented out?
===

Im trying to login to a punbb forum from a different page on the same domain using curl.

When logging in, curl gets executed and its initial response is the 'succesful login' page of the forum. However! No cookie got set thus when clicking any link in that forum, i'm logged out.

After a bit of investigating my cookiejar file mentions the cookie needed to login. If im creating this cookie and its value manually into my browser, i am succesfully logged in and all is well. So the cookie value stored is correct.

However! The line containing my cookie name/value in the cookiejar is commented out?

first question: Why?
second: How to prevent that behavior?

Here's my cookiejar:

    # Netscape HTTP Cookie File
    # http://curl.haxx.se/rfc/cookie_spec.html
    # This file was generated by libcurl! Edit at your own risk.

    www.mydomain.com	FALSE	/	FALSE	0	PHPSESSID	3d7oe6vt3blv3vs3ea94nljcs7
    #HttpOnly_www.mydomain.com	FALSE	/	FALSE	1340974408	forum_cookie_e19209	MnwyYWQ4OGViNDI2NjE5MWEwMGZiNGZkNDFmZDY5ZDZhYjM5OTA5NDVjfDEzNDA5NzQ0MDh8OTU0NTExOGZhNWNlNGY5OGMzZDk3MmE0NDlmMWRjNzM3ZjI1NzMxOA%3D%3D

And here's my curl call:

    function forumLogin() {
        $loginFields = array('req_username' => $_REQUEST['username']
                            ,'req_password' => $_REQUEST['password']
                            ,'form_sent' => "1"
                        ); //and so on
        $login = getUrl('http://www.mydomain.com/manager/forum/login.php', 'post', $loginFields);
       return $login;
    }

    function getUrl($url, $method='', $vars='') 
    {
      $ch = curl_init();
      if ($method == 'post') {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
      }
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
      curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
        $buffer = curl_exec($ch);
      curl_close($ch);
      return $buffer;
    }

    // successful login so reset fail count and update key values
    if(isset($_SESSION['mgrValidated'])) {
        $sql = "update $dbase.`".$table_prefix."user_attributes` SET failedlogincount=0, logincount=logincount+1, lastlogin=thislogin, thislogin=".time().", sessionid='$currentsessionid' where internalKey=$internalKey";
        $rs = mysql_query($sql);
        var_dump( forumLogin() );
    }
    exit;
