I used phplib's auth class. The final code is similar to
$auth->check('NameOfPermission');
at the beginning of each page. I put my phplib site together over two years ago, however, so there may be better stuff around now.
http://db.etree.org/source/
for some of my code.