aMember check for a logged in user using php

Recently I needed to verify if a user was logged in on a site using aMemberPro. But the site uses the new_write method, and I needed a way to check for this quickly in a php file for an include block. Here is what I added to the php page:
session_start();;
$amember_id = (isset($_SESSION[‘_amember_id’]) && !empty($_SESSION[‘_amember_id’])) ? $_SESSION[‘_amember_id’] : false;
if (!$amember_id) {
include('path/to/my/block.inc.php');
}

Not sure how right or wrong this is, but it works rather well.

Page 2 of 2 pages  < 1 2