$x "; exit(); } function error($x) { reply("$x"); } function success($x) { reply("\n$x"); } db_init(); $tuser = lookup_tentative_user($nonce); if (!$tuser) { error("nonce not found"); } if (!$tuser->confirmed) { success("0"); } $user = lookup_user_email_addr($tuser->email_addr); if (!$user) { $authenticator = random_string(); $cross_project_id = random_string(); $now = time(); $query = "insert into user (create_time, email_addr, authenticator, cross_project_id) values($now, '$tuser->email_addr', '$authenticator', '$cross_project_id')"; $result = mysql_query($query); $user = lookup_user_auth($authenticator); } if (!$user) { error("couldn't create user record"); } success("$user->authenticator"); ?>