2005-01-19 05:44:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("../inc/db.inc");
|
2005-02-25 00:41:22 +00:00
|
|
|
require_once("../inc/xml.inc");
|
2005-06-01 19:05:36 +00:00
|
|
|
require_once("../inc/email.inc");
|
2005-01-19 05:44:12 +00:00
|
|
|
|
2005-03-28 22:26:22 +00:00
|
|
|
db_init();
|
|
|
|
|
2005-02-25 00:41:22 +00:00
|
|
|
$nonce = process_user_text($_GET["nonce"]);
|
2005-01-19 05:44:12 +00:00
|
|
|
|
2005-02-25 00:41:22 +00:00
|
|
|
xml_header();
|
|
|
|
|
|
|
|
function reply($x) {
|
|
|
|
echo "<am_query_reply>
|
|
|
|
$x
|
|
|
|
</am_query_reply>
|
|
|
|
";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
function error($x) {
|
|
|
|
reply("<error>$x</error>");
|
|
|
|
}
|
|
|
|
|
|
|
|
function success($x) {
|
|
|
|
reply("<success/>\n$x");
|
|
|
|
}
|
|
|
|
|
2005-01-19 05:44:12 +00:00
|
|
|
$tuser = lookup_tentative_user($nonce);
|
|
|
|
|
|
|
|
if (!$tuser) {
|
2005-02-25 00:41:22 +00:00
|
|
|
error("nonce not found");
|
2005-01-19 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$tuser->confirmed) {
|
2005-02-25 00:41:22 +00:00
|
|
|
success("<confirmed>0</confirmed>");
|
2005-01-19 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$user = lookup_user_email_addr($tuser->email_addr);
|
|
|
|
if (!$user) {
|
2005-06-01 19:05:36 +00:00
|
|
|
$user = lookup_user_munged_email($tuser->email_addr);
|
|
|
|
}
|
|
|
|
if ($user) {
|
|
|
|
error("user record already exists");
|
2005-01-19 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 19:05:36 +00:00
|
|
|
$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);
|
|
|
|
|
2005-01-19 05:44:12 +00:00
|
|
|
if (!$user) {
|
2005-02-25 00:41:22 +00:00
|
|
|
error("couldn't create user record");
|
2005-01-19 05:44:12 +00:00
|
|
|
}
|
2005-02-25 00:41:22 +00:00
|
|
|
success("<account_key>$user->authenticator</account_key>");
|
2005-01-19 05:44:12 +00:00
|
|
|
|
|
|
|
?>
|