function auth($update = false)
{
    global $success, $errors, $authmech, $lti;
    $returnedproc = login_processing(false);
    list($success, $errors) = $returnedproc;
    if ($success && empty($errors)) {
        if ($update) {
            $lti->update_lti_user();
        } else {
            $lti->add_lti_user($authmech->getUsername());
        }
        login_processing2();
        //sucessfull authentication
    } else {
        html_headers();
        login_prompt($errors, '../');
    }
}
require_once dirname(__FILE__) . "/plugins.php";
startup();
require_once dirname(__FILE__) . "/config.php";
_load_language_file("/index.inc");
/**
 *
 * Login page, self posts to become management page
 *
 * @author Patrick Lockley
 * @version 1.0
 * @package
 */
include $xerte_toolkits_site->php_library_path . "display_library.php";
require_once dirname(__FILE__) . "/website_code/php/login_library.php";
login_processing();
login_processing2();
/*If the authentication method isn't set to Moodle
* the code in the required file below is simply skipped
*/
require_once dirname(__FILE__) . "/moodle_restrictions.php";
recycle_bin();
/*
 * Output the main page, including the user's and blank templates
 */
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
head_start();
?>