if ($CONF['configured'] !== true) { print "Installation not yet configured; please edit config.inc.php or write your settings to config.local.php"; exit; } if ($_SERVER['REQUEST_METHOD'] == "POST") { $lang = safepost('lang'); $fUsername = trim(safepost('fUsername')); $fPassword = safepost('fPassword'); if ($lang != check_language(0)) { # only set cookie if language selection was changed setcookie('lang', $lang, time() + 60 * 60 * 24 * 30); # language cookie, lifetime 30 days # (language preference cookie is processed even if username and/or password are invalid) } $h = new AdminHandler(); if ($h->login($fUsername, $fPassword)) { session_regenerate_id(); $_SESSION['sessid'] = array(); $_SESSION['sessid']['roles'] = array(); $_SESSION['sessid']['roles'][] = 'admin'; $_SESSION['sessid']['username'] = $fUsername; $_SESSION['PFA_token'] = md5(uniqid(rand(), true)); # they've logged in, so see if they are a domain admin, as well. if (!$h->init($fUsername)) { flash_error($PALANG['pLogin_failed']); } if (!$h->view()) { flash_error($PALANG['pLogin_failed']); } $adminproperties = $h->result(); if ($adminproperties['superadmin'] == 1) {