*** empty log message ***

svn path=/trunk/boinc/; revision=322
This commit is contained in:
Cecile Kim 2002-08-13 23:59:34 +00:00
parent d26b86d06f
commit 2bdf6b9d1a
8 changed files with 85 additions and 32 deletions

View File

@ -0,0 +1,18 @@
<?php
require_once("db.inc");
require_once("util.inc");
require_once("edit.inc");
db_init();
$user = get_user_From_cookie();
page_head("Change Password");
if ($user) {
print_change_password($user);
} else {
echo NOLOGIN;
}
page_tail();
?>

View File

@ -168,7 +168,8 @@ function show_user_profile($user) {
row("<b>Email address: <b>", $user->email_addr);
row("<b>Country: </b>", $user->country);
row("<b>Postal (ZIP) code: </b>", $user->postal_code);
echo "<tr><td align=right><a href=edit_user_info.php>Edit User Information</a></td></tr>\n";
echo "<tr><td align=right><a href=edit_user_info.php>Edit User Information</a></td>\n";
echo "<td align=center><a href=change_password.php>Change Password</a></td></tr>\n";
echo "</table>\n";
}

View File

@ -4,19 +4,49 @@ function print_edit_user_info($user) {
printf(
"<form method=post action=edit_action.php>\n"
.TABLE2."\n"
."<tr>".TD3.LG_FONT."<b>User Information:</b></font></td></tr>\n"
."<tr><td colspan=2><b>To edit your User Information, fill out the fields that you wish to change.\n"
." You do not need to enter anything into the fields that you wish to keep the same.</td></tr>\n"
."<tr><td colspan=2><br></td></tr>\n"
."<tr>".TD2.LG_FONT."<b>User name:</b></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>\n";
row2("<input name=my_name type=text size=30>", $user->name);
echo "<tr><td colspan=2><br></td></tr>\n";
echo "<tr>".TD2.LG_FONT."<b>Email address:</b></td></tr>\n";
row2("<input name=my_email type=text size=50>", $user->email_addr);
echo "<tr><td colspan=2><br></td></tr>\n";
echo "<tr>".TD2.LG_FONT."<b>Country:</b></td></tr>\n";
echo "<tr><td><select name=my_country>\n";
print_country_select();
echo "</select></td>\n";
echo "<td>$user->country</td></tr>\n";
row3("<b>Postal (ZIP) code: </b>", "<input name=my_zip type=text size=20>", $user->postal_code);
echo "<td>$user->country</td></tr>\n";
echo "<tr><td colspan=2><br></td></tr>\n";
echo "<tr>".TD2.LG_FONT."<b>Postal (ZIP) code:</b></td></tr>\n";
row2("<input name=my_zip type=text size=20>", $user->postal_code);
echo "</table>\n";
echo "<br><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;<input type=submit value=\"Edit\">\n";
echo "</form>";
}
function print_change_password($user) {
printf(
"<form method=post action=change_pass_action.php>\n"
.TABLE2."\n"
. "<tr>".TD.LG_FONT."<b>Old Password:</b></td></tr>\n"
."<tr><td><b>To change your password, please enter your old password below:</b></td></tr>\n"
."<tr><td><input name=my_pass type=password></td></tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>".TD.LG_FONT."<b>New Password:</b></td></tr>\n"
."<tr><td><b>Next, enter your new password:</b></td></tr>\n"
."<tr><td><input name=new_pass type=password></td></tr>\n"
."<tr><td><b>Retype password to confirm:</td></tr>"
."<tr><td></b><input name=new_pass2 type=password></td></tr>\n"
."</table>\n"
."<br><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;<input type=submit value=\"Change Password\">\n"
."</form>\n"
);
}
function print_update_ok($e_ok) {
if ($e_ok == EMAIL_EXISTS) {
printf(

View File

@ -9,7 +9,6 @@
$user = get_user_from_cookie();
page_head("Updating User Account");
printf("%d, %s\n", strlen($HTTP_POST_VARS["my_email"]), $HTTP_POST_VARS["my_email"]);
if ($user) {
$my_email = $HTTP_POST_VARS["my_email"];
$my_name = $HTTP_POST_VARS["my_name"];

View File

@ -12,7 +12,7 @@
print_edit_user_info($user);
} else {
page_head("Edit User Information");
printf("Not Logged in. Click <a href=login.php>here</a> to login.\n");
echo NOLOGIN;
}
page_tail();

View File

@ -7,12 +7,11 @@
$project = db_init();
$user = get_user_from_cookie();
if ($user) {
$head = sprintf("%s's User Page for %s", $user->name, $project);
$head = sprintf("%s's User Page", $user->name);
page_head($head);
show_user_page($user, $project);
} else {
$head = sprintf("Login to %s", $project);
page_head($head);
page_head("Log in");
print_login_form();
}
page_tail();

View File

@ -15,22 +15,18 @@
mysql_free_result($result);
}
if (!$user) {
$head = sprintf("Logging in to %s", $project);
page_head($head);
page_head("Logging in");
echo "There is no account with the email address you have entered.\n";
echo "Click the <b>Back</b> button to re-enter email address.\n";
} else if ($user->web_password != $HTTP_POST_VARS["existing_password"]) {
$head = sprintf("Logging in to %s", $project);
page_head($head);
echo "Invalid password. Click the <b>Back</b> button to re-enter password.";
page_head("Logging in");
echo BADPASS;
} else {
setcookie("auth", $user->authenticator, time()+100000000);
$head = sprintf("%s User Page", $project);
page_head($head);
page_head("User Page");
show_user_page($user, $project);
}
} else if (strlen($HTTP_POST_VARS["new"])) {
$head = sprintf("Creating %s Account", $project);
$query = sprintf(
"select * from user where email_addr='%s'",
$HTTP_POST_VARS["new_email_addr"]
@ -41,7 +37,7 @@
mysql_free_result($result);
}
if ($user) {
page_head($head);
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>There's already an account with that email address. Click the <b>Back</b> button\n"
@ -51,12 +47,11 @@
);
} else {
if ($HTTP_POST_VARS["new_password"] != $HTTP_POST_VARS["new_password2"]) {
page_head($head);
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>You've typed two different passwords. Click the <b>Back</b> button on your \n"
."browser to edit your information, making sure you type the same password in both password\n"
." fields.</td></tr>\n"
."<tr><td>".DIFFPASS
."</td></tr>\n"
."</table>\n"
);
} else {
@ -75,7 +70,7 @@
$result = mysql_query($query);
if ($result) {
setcookie("auth", $authenticator);
page_head($head);
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>Account has been created successfully. In order to run the client you will need a BOINC key. A key will be sent to \n"
@ -87,7 +82,7 @@
);
mail($email_addr, "BOINC key", "Your BOINC key is " . $authenticator);
} else {
page_head($head);
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>Couldn't create account. Please try again later.</td></tr>\n"

View File

@ -9,6 +9,7 @@ define("EMAIL_FAIL", -2);
define("LG_FONT", "<font size=+1>");
define("SM_FONT", "<font size=-1>");
define("TD", "<td bgcolor=#708090>");
define("TD2", "<td colspan=2 bgcolor=#708090>");
define("TD3", "<td colspan=3 bgcolor=#708090>");
@ -19,8 +20,16 @@ define("BG_COLOR", " bgcolor=cccccc ");
define("TITLE_COLOR", " bgcolor=000000 ");
define("TITLE_FONT", " <font color=ffffff> ");
define("BODY_COLOR", " bgcolor=ffffff ");
define("NOLOGIN", "Not logged in. <a href=login.php>Login.</a>\n");
define("PROJECT", "Sample Project");
define("NOLOGIN", "Not logged in. Click <a href=login.php>here</a> to login.\n");
define("BADPASS", "The password you entered is incorrect. Click the <b>Back</b> button on your browser to re-enter your password or try again later.");
define("DIFFPASS", "You've typed two different passwords. Click the <b>Back</b> button on your browser to edit your information, making sure you type the same password in both password fields.");
function get_project_name() {
$fp = fopen(db_name, "r");
$db_name = fgets($fp, 1024);
$db_name = rtrim($db_name);
return $db_name;
}
function get_user_from_cookie() {
$auth = "";
@ -35,7 +44,8 @@ function show_login($user) {
if ($user) {
printf("Logged in as %s.\n", $user->name);
printf("<br><a href=login.php>Log in as someone else.</a>\n");
printf("<br><a href=this_user.php>My %s</a>\n", PROJECT);
$project = get_project_name();
printf("<br><a href=this_user.php>My %s</a>\n", $project);
} else {
echo NOLOGIN;
}
@ -43,12 +53,13 @@ function show_login($user) {
function page_head($title) {
echo "<head><title>$title</title><body " . BG_COLOR . ">\n";
echo TABLE . "<tr " . TITLE_COLOR . "><td>" . TITLE_FONT . "<font size=6><b><a href=index.php>".PROJECT.":</a> $title</b></font></td></tr></table>\n";
$project = get_project_name();
echo TABLE . "<tr " . TITLE_COLOR . "><td>" . TITLE_FONT . "<font size=6><b><a href=index.php>".$project.":</a> $title</b></font></td></tr></table>\n";
}
function page_tail() {
echo "<hr><table width=100%><tr><td align=center>|<a href=create_account.php> Create New Account </a>|<a href=login.php> Login </a>\n";
echo "|<a href=home.php> User Page </a>|<a href=team.php> Teams </a>|<a href=index.html> Main Project Page </a>|</td></tr></table>\n";
echo "|<a href=home.php> User Page </a>|<a href=team.php> Teams </a>|<a href=index.php> Main Project Page </a>|</td></tr></table>\n";
}
function date_str($when) {