setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "{$_POST['username']}");
Oh... Errr....
Never trust cookies. Having a "loggedin" cookie set to true is a horrible thing security wise. Cookies can easily be manipulated. Instead, set a session value or something.
Also, if you ever want to have a "Remember Me" feature, put the username and some token that a user could not know without actually having done it legitly.