I'll just quickly point out that 'if($hasAccess==1)' is bad style and could just as easily be if($hasAccess) as if($_procObj==0) should be if(!$_procObj).