2004-06-09 19:15:57 +00:00
|
|
|
<?php
|
2005-02-08 03:33:35 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2003-08-22 05:36:25 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
// create an account with given email address
|
|
|
|
//
|
2005-02-08 03:33:35 +00:00
|
|
|
function create_account($email_addr, $user_name, $munge) {
|
|
|
|
$user->authenticator = random_string();
|
|
|
|
$user->name = $user_name;
|
2004-12-06 22:41:19 +00:00
|
|
|
if ($munge) {
|
2005-02-08 03:33:35 +00:00
|
|
|
$email_addr = munge_email_addr($email_addr, $user->authenticator);
|
2003-08-22 05:36:25 +00:00
|
|
|
}
|
2005-02-08 03:33:35 +00:00
|
|
|
$user->cross_project_id = random_string();
|
2003-08-22 05:36:25 +00:00
|
|
|
$t = time();
|
2005-04-15 22:58:32 +00:00
|
|
|
$query = "insert into user (create_time, email_addr, name, authenticator, cross_project_id) values ($t, '$email_addr', '$user->name', '$user->authenticator', '$user->cross_project_id')";
|
2003-08-22 05:36:25 +00:00
|
|
|
$result = mysql_query($query);
|
2005-02-08 03:33:35 +00:00
|
|
|
if ($result) return $user;
|
2004-12-06 22:41:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once("../inc/util_ops.inc");
|
2005-02-08 03:33:35 +00:00
|
|
|
require_once("../inc/email.inc");
|
2004-12-06 22:41:19 +00:00
|
|
|
|
2005-02-08 03:33:35 +00:00
|
|
|
admin_page_head("Create User Account");
|
2004-12-06 22:41:19 +00:00
|
|
|
db_init();
|
|
|
|
$email_addr = trim($_GET["email_addr"]);
|
|
|
|
$email_addr = strtolower($email_addr);
|
|
|
|
|
|
|
|
// see if email address is taken
|
|
|
|
$query = "select * from user where email_addr='$email_addr'";
|
|
|
|
$result = mysql_query($query);
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
if ($user) {
|
|
|
|
echo "That email address ($email_addr) is taken";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
$user_name = $_GET["user_name"];
|
|
|
|
$user = create_account($email_addr, $user_name, true);
|
|
|
|
if (!$user) {
|
|
|
|
echo "couldn't create account:".mysql_error();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2005-02-08 03:33:35 +00:00
|
|
|
$url = URL_BASE."account_created.php?email_addr=".urlencode($email_addr);
|
2004-12-06 22:41:19 +00:00
|
|
|
echo "
|
|
|
|
<h2>Account created for:<br/>
|
|
|
|
$user_name<br/>
|
|
|
|
at email address:<br/>
|
|
|
|
$email_addr</h2><br/>
|
|
|
|
Note: The user (not YOU, the admin) must confirm by visiting:<br/>
|
|
|
|
<a href=\"$url\"> $url </a>
|
|
|
|
";
|
|
|
|
|
2005-04-15 22:58:32 +00:00
|
|
|
$user->email_addr = $email_addr;
|
2005-02-08 03:33:35 +00:00
|
|
|
send_auth_email($user, true, false);
|
2004-11-18 10:52:20 +00:00
|
|
|
|
2005-02-08 03:33:35 +00:00
|
|
|
admin_page_tail();
|
2003-08-22 05:36:25 +00:00
|
|
|
?>
|