}
if (!isset($_REQUEST['name']) || is_array($_REQUEST['name'])) {
$name = '';
} else {
$name = $_REQUEST['name'];
}
if (!isset($_REQUEST['key']) || is_array($_REQUEST['key'])) {
$key = 'nokey';
// will never match since hash values are either NULL or 32 characters
} else {
$key = $_REQUEST['key'];
}
require 'includes/basics.php';
$view = new Zend_View();
$view->setBasePath(WEBROOT . '/templates');
$authPlugin = Kimai_Registry::getAuthenticator();
$view->assign('kga', $kga);
// current database setup correct?
checkDBversion(".");
// processing login and displaying either login screen or errors
$name = htmlspecialchars(trim($name));
$is_customer = $database->is_customer_name($name);
if ($is_customer) {
$id = $database->customer_nameToID($name);
$customer = $database->customer_get_data($id);
$keyCorrect = $key === $customer['passwordResetHash'];
} else {
$id = $database->user_name2id($name);
$user = $database->user_get_data($id);
$keyCorrect = $key === $user['passwordResetHash'];
}