I'd advise to move this part near the top:
Code:
// pre-cache templates used by all actions
$globaltemplates = array(
'GTLIST'
'GT_listbit
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
Especially because without the global.php you won't be able to use the object $DB_site
Then, you'll also need to move this:
Code:
while($row=mysql_fetch_object($GT))
{
$who = $row->username;
$gtname = $row->field5;
eval('$gtbit = "' . fetch_template('GT_listbit') . '";');
}
eval('print_output("' . fetch_template('GTLIST') . '");');
further down, as that has to be able to use $GT, which you only define later on.
And lastly, it won't help doing two queries if they both have the same varname, as the second will overwrite the first.
You might try to just use on query.
I'll post an edited version if I have time later on, gotta go now