<?php
// This function will check to see if the currently logged in user has the specified permission passed to it.
function ppAccessCheck($memLevel) {
	
	$ppLevels = $_SESSION["user_levels"];
	
	if(is_array($ppLevels) && in_array($memLevel, $ppLevels)) {
		return 'hasaccess';
	} else {
		return 'noaccess';
	}
}

// Place this where you want to return the 'hasaccess' or 'noaccess' value
echo ppAccessCheck('Your Membership Level');


// OR use this string (or change it to an int if you just want it to be a flag) to check if the user has access. For example:
if ( ppAccessCheck('Your Membership Level') == 'hasaccess' )
{
    // Do something awesome like show members only content
    echo memberContent();
}
else
{
    // Perhaps say something like...
    echo 'Oops... it looks like you don\'t have access. Try logging in!';
}