2005-08-11 00:17:00 +00:00
|
|
|
<?php
|
|
|
|
|
2007-10-30 18:16:29 +00:00
|
|
|
include_once("../inc/boinc_db.inc");
|
2005-08-11 00:17:00 +00:00
|
|
|
include_once("../inc/util.inc");
|
|
|
|
|
|
|
|
function show_error($str) {
|
|
|
|
page_head("Can't update account");
|
|
|
|
echo "$str<br>\n";
|
2007-11-12 22:28:17 +00:00
|
|
|
echo BoincDb::error();
|
2005-08-11 00:17:00 +00:00
|
|
|
echo "<p>Click your browser's <b>Back</b> button to try again.\n<p>\n";
|
|
|
|
page_tail();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$auth = process_user_text(post_str("auth"));
|
|
|
|
$name = process_user_text(post_str("name"));
|
2007-10-30 18:16:29 +00:00
|
|
|
|
2005-08-11 00:17:00 +00:00
|
|
|
if (strlen($name)==0) {
|
|
|
|
show_error("You must supply a name for your account");
|
|
|
|
}
|
|
|
|
if ($new_name != strip_tags($new_name)) {
|
|
|
|
show_error("HTML tags not allowed in name");
|
|
|
|
}
|
|
|
|
|
|
|
|
$country = post_str("country");
|
|
|
|
if (!is_valid_country($country)) {
|
2007-10-02 03:19:03 +00:00
|
|
|
show_error( "invalid country");
|
2005-08-11 00:17:00 +00:00
|
|
|
}
|
|
|
|
|
2005-09-09 20:28:55 +00:00
|
|
|
$postal_code = strip_tags(process_user_text(post_str("postal_code", true)));
|
2005-08-11 00:17:00 +00:00
|
|
|
|
2007-10-30 18:16:29 +00:00
|
|
|
$user = BoincUser::lookup("authenticator='$auth'");
|
|
|
|
if (!$user) {
|
|
|
|
error_page("no such user");
|
|
|
|
}
|
|
|
|
$retval = $user->update("name='$name', country='$country', postal_code='$postal_code'");
|
2005-08-11 00:17:00 +00:00
|
|
|
if (!$retval) {
|
|
|
|
show_error("database error");
|
|
|
|
}
|
|
|
|
|
2005-10-03 19:21:19 +00:00
|
|
|
session_start();
|
|
|
|
$_SESSION["authenticator"] = $auth;
|
2007-10-02 03:19:03 +00:00
|
|
|
Header("Location: team_search.php");
|
2005-10-03 19:21:19 +00:00
|
|
|
setcookie('auth', $auth, time()+3600*24*365);
|
2007-10-02 03:19:03 +00:00
|
|
|
setcookie('init', "1", time()+3600*24*365);
|
2005-08-11 00:17:00 +00:00
|
|
|
|
|
|
|
?>
|