2006-12-01 00:38:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("docutil.php");
|
|
|
|
require_once("spoken_languages.php");
|
|
|
|
require_once("help_funcs.php");
|
|
|
|
require_once("help_db.php");
|
|
|
|
require_once("countries.inc");
|
|
|
|
|
|
|
|
function print_form($vol, $action_name) {
|
|
|
|
list_start();
|
|
|
|
list_item(
|
|
|
|
"Name or nickname",
|
|
|
|
input("volname", $vol->name)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Email address<br><font size=-2>This won't be publicized,
|
|
|
|
but user email may be sent here.
|
|
|
|
Use a separate mailbox if you want.</font>",
|
|
|
|
input("email_addr", $vol->email_addr)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Password",
|
|
|
|
password("password", $vol->password)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Skype ID<br><font size=-2>
|
|
|
|
This will be publicized.
|
|
|
|
Use a Skype account other than
|
|
|
|
your primary one if you want.</font>",
|
|
|
|
input("skypeid", $vol->skypeid)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Primary language",
|
|
|
|
spoken_language_list("lang1", $vol->lang1)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Secondary language",
|
|
|
|
spoken_language_list("lang2", $vol->lang2)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Country",
|
|
|
|
"<select name=country>".country_select($vol->country)."</select>"
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Specialties<br><font size=-2>
|
|
|
|
What kinds of computers (Windows/Mac/Linux)
|
|
|
|
and/or networking technologies (proxies, NATs)
|
|
|
|
are you most familiar with?</font>",
|
|
|
|
textarea("specialties", $vol->specialties)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Projects<br><font size=-2>
|
|
|
|
Do you specialize in any particular BOINC-based projects?</font>",
|
|
|
|
textarea("projects", $vol->projects)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"What days and times are you typically available for help?
|
|
|
|
<br><font size=-2>Include your time zone, or use UTC</font>",
|
|
|
|
textarea("availability", $vol->availability)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Is Skype voice OK?",
|
|
|
|
yesno("voice_ok", $vol->voice_ok)
|
|
|
|
);
|
|
|
|
list_item(
|
|
|
|
"Is Skype text OK?",
|
|
|
|
yesno("text_ok", $vol->text_ok)
|
|
|
|
);
|
2006-12-05 03:50:36 +00:00
|
|
|
list_item(
|
|
|
|
"Hide your account?",
|
|
|
|
yesno("hide", $vol->hide)
|
|
|
|
);
|
2006-12-01 00:38:36 +00:00
|
|
|
list_item(
|
|
|
|
"",
|
|
|
|
"<input type=submit name=$action_name value=OK>"
|
|
|
|
);
|
|
|
|
list_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_form_data() {
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->name = stripslashes($_GET['volname']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!$vol->name) boinc_error_page("Name must not be blank");
|
|
|
|
if (strstr($vol->name, "<")) boinc_error_page("No < allowed");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->password = stripslashes($_GET['password']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!$vol->password) boinc_error_page("Password must not be blank");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->email_addr = stripslashes($_GET['email_addr']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!$vol->email_addr) boinc_error_page("Email address must not be blank");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->skypeid = stripslashes($_GET['skypeid']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!$vol->skypeid) boinc_error_page("Skype ID must not be blank");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->lang1 = stripslashes($_GET['lang1']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!$vol->lang1) boinc_error_page("Primary language must not be blank");
|
|
|
|
if (!is_spoken_language($vol->lang1)) boinc_error_page("Not a language");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->lang2 = stripslashes($_GET['lang2']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!is_spoken_language($vol->lang2)) boinc_error_page("Not a language");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->country = stripslashes($_GET['country']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (!is_valid_country($vol->country)) boinc_error_page("Bad country");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->specialties = stripslashes($_GET['specialties']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (strstr($vol->specialties, "<")) boinc_error_page("No < allowed");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->projects = stripslashes($_GET['projects']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (strstr($vol->projects, "<")) boinc_error_page("No < allowed");
|
2006-12-02 04:32:22 +00:00
|
|
|
$vol->availability = stripslashes($_GET['availability']);
|
2009-12-18 04:32:30 +00:00
|
|
|
if (strstr($vol->availability, "<")) boinc_error_page("No < allowed");
|
2006-12-01 00:38:36 +00:00
|
|
|
$vol->voice_ok = $_GET['voice_ok']?1:0;
|
|
|
|
$vol->text_ok = $_GET['text_ok']?1:0;
|
2006-12-05 03:50:36 +00:00
|
|
|
$vol->hide = $_GET['hide']?1:0;
|
2006-12-01 00:38:36 +00:00
|
|
|
return $vol;
|
|
|
|
}
|
|
|
|
|
|
|
|
function email_password($vol) {
|
|
|
|
page_head("Emailing password");
|
|
|
|
echo "We're emailing your Help Volunteer password to $vol->email_addr.";
|
|
|
|
page_tail();
|
|
|
|
$body = "Your BOINC Help Volunteer password is:\n$vol->password\n";
|
|
|
|
mail($vol->email_addr, "Help Volunteer info", $body, "From: BOINC");
|
|
|
|
}
|
|
|
|
|
|
|
|
$create = $_GET['create'];
|
|
|
|
$edit_login = $_GET['edit_login'];
|
|
|
|
$edit_form = $_GET['edit_form'];
|
|
|
|
$edit_action = $_GET['edit_action'];
|
|
|
|
if ($create == 'OK') {
|
|
|
|
$vol = get_form_data();
|
|
|
|
$vol->create_time = time();
|
|
|
|
$vol->timezone = 99;
|
|
|
|
|
|
|
|
$vol2 = vol_lookup_name($vol->name);
|
|
|
|
if ($vol2) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("That name is already taken");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
$vol2 = vol_lookup_email($vol->email_addr);
|
|
|
|
if ($vol2) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("There's already an account with email address $vol->email_addr");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
$retval = vol_insert($vol);
|
|
|
|
if (!$retval) {
|
|
|
|
echo mysql_error();
|
|
|
|
page_head("database error");
|
|
|
|
} else {
|
|
|
|
page_head("Registration finished");
|
|
|
|
echo "
|
|
|
|
Thanks - you're now registered as a BOINC Help Volunteer.
|
2006-12-02 04:32:22 +00:00
|
|
|
<p>
|
|
|
|
If later you want to change your account information,
|
|
|
|
go to the <a href=help.php>Help page</a>
|
|
|
|
and click on the link at the bottom of the page.
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
page_tail();
|
|
|
|
} else if ($edit_login) {
|
|
|
|
page_head("Edit your Help Volunteer account");
|
|
|
|
echo "Please enter the email address and password
|
|
|
|
of your Help Volunteer account.
|
|
|
|
<form action=help_vol_edit.php>
|
|
|
|
";
|
|
|
|
list_start();
|
|
|
|
list_item("Email address", input("email_addr", ""));
|
|
|
|
list_item("Password<br><font size=-2>If you forgot your password,
|
|
|
|
leave this blank, and we'll email it to you.</font>",
|
2006-12-04 17:10:39 +00:00
|
|
|
password("password", "")
|
2006-12-01 00:38:36 +00:00
|
|
|
);
|
|
|
|
list_item("", "<input type=submit name=edit_form value=OK>"
|
|
|
|
);
|
|
|
|
list_end();
|
|
|
|
echo "</form>\n";
|
|
|
|
page_tail();
|
|
|
|
} else if ($edit_form == "OK") {
|
2006-12-02 04:32:22 +00:00
|
|
|
$email_addr = stripslashes($_GET['email_addr']);
|
|
|
|
$password = stripslashes($_GET['password']);
|
2006-12-01 00:38:36 +00:00
|
|
|
$vol = vol_lookup_email($email_addr);
|
|
|
|
if (!$vol) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("Bad email address $email_addr");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
if (!$password) {
|
|
|
|
email_password($vol);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if ($password != $vol->password) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("Bad password");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
page_head("Edit your Help Volunteer Account");
|
|
|
|
echo "
|
|
|
|
<form action=help_vol_edit.php>
|
|
|
|
<input type=hidden name=old_email_addr value=\"$email_addr\">
|
|
|
|
<input type=hidden name=old_password value=\"$password\">
|
|
|
|
";
|
|
|
|
print_form($vol, 'edit_action');
|
|
|
|
echo "</form>\n";
|
|
|
|
page_tail();
|
|
|
|
} else if ($edit_action) {
|
2006-12-02 04:32:22 +00:00
|
|
|
$old_email_addr = stripslashes($_GET['old_email_addr']);
|
|
|
|
$old_password = stripslashes($_GET['old_password']);
|
2006-12-01 00:38:36 +00:00
|
|
|
$vol = vol_lookup_email($old_email_addr);
|
|
|
|
if (!$vol) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("Bad email address $old_email_addr");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
if ($old_password != $vol->password) {
|
2009-12-18 04:32:30 +00:00
|
|
|
boinc_error_page("Bad password");
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
$vol2 = get_form_data();
|
|
|
|
$vol2->timezone = $vol->timezone;
|
|
|
|
$vol2->id = $vol->id;
|
|
|
|
$retval = vol_update($vol2);
|
|
|
|
if (!$retval) {
|
|
|
|
echo mysql_error();
|
|
|
|
page_head("database error");
|
|
|
|
page_tail();
|
|
|
|
} else {
|
|
|
|
page_head("Update completed");
|
|
|
|
echo "Your Help Volunteer account information has been updated.";
|
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
page_head("Register as a BOINC Help Volunteer");
|
|
|
|
$vol = null;
|
|
|
|
$vol->voice_ok = 1;
|
|
|
|
$vol->text_ok = 1;
|
|
|
|
echo "<form action=help_vol_edit.php>\n";
|
|
|
|
print_form($vol, 'create');
|
|
|
|
echo "</form>\n";
|
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|