This part won't work:
, but otherwise you're good to go. I'd put those into an array, and make it simple:
$aPages = array(
if(!isset($_SESSION['username']) && in_array($pageName, $aPages))
There is no rule that says you need to compare a variable to a constant, it is legal to do $this == $that.