Cookies are a great way to control whether or not a user is logged in. A simple, yet insecure way would be to simply write a cookie "loggedin" upon successful login, and delete it upon logout.
More complex cookie login/logout logic could instead store a large, random string that is tracked in the database upon login. Upon logout, the database deletes the random string used for the cookie value, and the cookie is also deleted. This way, even if someone stole the cookie and tried to re-use it, upon page generation, it would check the status of that random string, and deny access to the page.