Here's an updated version that will also show a templated php file:
PHP Code:
<?php
error_reporting(7);
require('./global.php');
if ($bbuserinfo['userid']==0) {
show_nopermission();
}
$username=$bbuserinfo['username'];
eval("dooutput(\"".gettemplate('templatenamehere')."\");");
?>
This will show the error/not logged in page if they are not logged in.
I left the CHDIR out, but feel free to add it if you need it.