Check if the user is logged in trough a function in php
===

I have a little problem with PHP, probably for most of you it's a stupid problem, but I need your help.<br>
Here's my code:

    function is_logged() {
	if(isset($_COOKIE['username'])) {
		return true;
	} else {
		return false;
	}
    }

And here is a piece of the whole code where I need to deny someone the access if isn't logged.

    if(!is_logged()) {
	header("Location: ./?act=Home");
    }

Where do I made the mistake?