The code that sets the cookies is after the login code, so it will never have the opportunity to set the cookies, the login wuill redirect before it gets to the cooki code.
Move the cookie code:
<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("remember", "".((isset($_POST["username"]))?$_POST["username"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>
<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("password", "".((isset($_POST["pwd"]))?$_POST["pwd"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>
<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("remember", "1", time()+(60*60*24*30), "/", "", 0);
}
?>
to line 2 so the cookies can be set before he login proceeds.