PHP Login Cookie questions (Figured it out)

I figured this out just now. Thanks anyways!

I’m trying to set a cookie when users log into my website. Inside the login script (after checking that the username and pass correspond), I have:

session_start(); $_SESSION['user_id'] = $row['ID']; $_SESSION['logged_in'] = TRUE; if(isset($_POST['remember'])) { setcookie ("user", md5($_POST['username']), time() 60*60*24*365); setcookie ("pass", md5($_POST['password']), time() 60*60*24*365); } header("Location: redirect.php"); “remember” is a checkbox giving the “remember me” option. When I login and choose the “remember me” option, I log in fine. When I close my browser and go back to my page, I’m logged out again. Did I set the cookies wrong? Do I need to check for cookies on every single one of my pages?
Thanks for the help everyone!