\n";
echo "-208\n";
echo "\n";
exit();
}
$email_addr = get_str("email_addr");
$email_addr = process_user_text(strtolower($email_addr));
$passwd_hash = process_user_text(get_str("passwd_hash"));
$user_name = process_user_text(get_str("user_name"));
if (!is_valid_email_addr($email_addr)) {
echo "\n";
echo " -205\n";
echo "\n";
exit();
}
if (strlen($passwd_hash) != 32) {
echo "\n";
echo " -206\n";
echo "\n";
exit();
}
$user = lookup_user_email_addr($email_addr);
$bad = false;
if ($user) {
if ($user->passwd_hash != $passwd_hash) {
$bad = true;
} else {
$authenticator = $user->authenticator;
}
} else {
$authenticator = random_string();
$cross_project_id = random_string();
$now = time();
$query = "insert into user (create_time, email_addr, name, authenticator, expavg_time, send_email, show_hosts, cross_project_id, passwd_hash) values($now, '$email_addr', '$user_name', '$authenticator', unix_timestamp(), 1, 1, '$cross_project_id', '$passwd_hash')";
$result = mysql_query($query);
if (!$result) {
$bad = true;
}
}
if ($bad) {
echo "\n";
echo " -207\n";
echo "\n";
} else {
echo " \n";
echo " $authenticator\n";
echo "\n";
}
?>