// call our header file and pass it some variables
 $tpl->assign('TITLE', $defined['title'], NULL, NULL);
 $tpl->assign('DESCRIPTION', "Manage Pools", NULL, NULL);
 $tpl->assign('STYLE', $style, NULL, NULL);
 // authentication template
 $FILE = "auth.tpl";
 // default is no error just diplay login form
 if ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === -1) {
     // well looks like at least one login attempt has been processed, show empty field error
     if ($_SESSION['x']++ >= 1) {
         $ERROR = $err->GenerateErrorLink("help/help.html", "#missing", $defined['error'], $errors['auth_e'], NULL, NULL);
     }
     // timeout with authentication token
 } elseif ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === -2) {
     $ERROR = $err->GenerateErrorLink("help/help.html", "#timeout", $defined['error'], $errors['auth_to'], NULL, NULL);
     $misc->ExitApplication($_SESSION['token']);
     // error in validation of authentication data
 } elseif ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === -3) {
     $ERROR = $err->GenerateErrorLink("help/help.html", "#alphanum", $defined['error'], $errors['val_alp'], NULL, NULL);
     // authentication data not found in database
 } elseif ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === -4) {
     $ERROR = $err->GenerateErrorLink("help/help.html", "#user", $defined['error'], $errors['auth_n'], NULL, NULL);
     // error in database query
 } elseif ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === -5) {
     $ERROR = $err->GenerateErrorLink("help/help.html", "#undef", $defined['error'], $errors['undef_sql'], NULL, NULL);
     // valid user found
 } elseif ($auth->AuthUser($_POST['user'], $_POST['pass'], $_SESSION['token']) === 0) {
     // perform permissions check with access level and group data
     if ($level->ChkLevel($_SESSION['token']) === "admin") {
         // define some variables for the template etc.
         $JS = " hidediv('extras'); hidediv('perms');";