mirror of https://github.com/BOINC/boinc.git
added edit.inc, edit_action.php, edit_user_info.php
svn path=/trunk/boinc/; revision=293
This commit is contained in:
parent
8007e5bf81
commit
05b2a28785
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
function print_edit_user_info($user) {
|
||||
printf(
|
||||
"<form method=post action=edit.php>\n"
|
||||
.TABLE2."\n";
|
||||
."<tr>".TD3.LG_FONT."<b>User Information:</b></font></td></tr>\n"
|
||||
);
|
||||
row3("<b>User name: </b>", "<input name=my_name type=text size=30>", $user->name);
|
||||
row3("<b>Email address: </b>", "<input name=my_email type=text size=50>", $user->email_addr);
|
||||
echo "<tr><td><b>Country: </b></td><td><select name=my_country></td>\n";
|
||||
print_country_select();
|
||||
echo "</select>";
|
||||
row3("<b>Postal (ZIP) code: </b>", "<input name=my_zip type=text size=20>", $user->postal_code);
|
||||
echo "<tr>".TD3."<br>/td></tr>\n";
|
||||
echo "<tr>".TD3."<input type=submit value=\"Edit\"></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
$project = db_init();
|
||||
$head = sprintf("Updating %s Account", $project);
|
||||
$user = get_user_from_cookie();
|
||||
|
||||
page_head($head);
|
||||
if ($user) {
|
||||
$my_name = $HTTP_POST_VARS["my_name"];
|
||||
$my_country = $HTTP_POST_VARS["my_country"];
|
||||
$my_zip = $HTTP_POST_VARS["my_zip"];
|
||||
|
||||
if (strlen($my_name) && strlen($my_country) && strlen($my_zip)) {
|
||||
$query = sprintf("update user set name='%s', country='%s', postal_code=%d where id=%d", $my_name, $my_country, $my_zip, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_ok();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
} else if (strlen($my_name) && strlen($my_country)) {
|
||||
query = sprintf("update user set name='%s', country='%s' where id=%d", $my_name, $my_country, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
} else if (strlen($my_country) && strlen($my_zip)) {
|
||||
query = sprintf("update user set country='%s', postal_code='%s' where id=%d", $my_country, $my_zip, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
} else if (strlen($my_name) && strlen($my_zip)) {
|
||||
query = sprintf("update user set name='%s', postal_code=%d where id=%d", $my_name, $my_zip, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
} else if (strlen($my_name)) {
|
||||
query = sprintf("update user set name='%s' where id=%d", $my_name, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
|
||||
} else if (strlen($my_zip)) {
|
||||
query = sprintf("update user set country='%s', postal_code='%s' where id=%d", $my_country, $my_zip, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
|
||||
} else if (strlen($my_country)) {
|
||||
query = sprintf("update user set country='%s', postal_code='%s' where id=%d", $my_country, $my_zip, $user->id);
|
||||
$result = mysql_query($query);
|
||||
if($result) {
|
||||
print_update_note();
|
||||
} else {
|
||||
print_update_fail();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$query = sprintf("select * from user where email_addr='%s',
|
||||
$HTTP_POST_VARS["my_email"]);
|
||||
$result = mysql_query($query);
|
||||
if ($result) {
|
||||
$user = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
if ($user) {
|
||||
printf(
|
||||
TABLE2."\n"
|
||||
."<tr><td>There's already an account with that email address. Click the <b>Back</b> button\n"
|
||||
." on your browser to edit your information, or <a href=login.php>login </a>to your \n"
|
||||
.$project." account.</td></tr>\n"
|
||||
."</table>\n"
|
||||
);
|
||||
} else {
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
require_once("edit.inc");
|
||||
require_once("util.inc");
|
||||
|
||||
$project = db_init();
|
||||
$user = get_user_from_cookie();
|
||||
|
||||
if ($user) {
|
||||
$head = sprintf("Edit %s's %s User Information", $user, $project);
|
||||
page_head($head);
|
||||
print_edit_user_info($user);
|
||||
} else {
|
||||
$head = sprintf("Edit %s User Information", $project);
|
||||
page_head($head);
|
||||
printf("Not Logged in. Click <a href=login.php>here</a> to login.\n");
|
||||
}
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue