From 2bdf6b9d1a8d8c8d269d30a00dda425980ea0d9f Mon Sep 17 00:00:00 2001 From: Cecile Kim Date: Tue, 13 Aug 2002 23:59:34 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=322 --- html/user/change_password.php | 18 +++++++++++++++ html/user/db.inc | 3 ++- html/user/edit.inc | 42 ++++++++++++++++++++++++++++++----- html/user/edit_action.php | 1 - html/user/edit_user_info.php | 2 +- html/user/home.php | 5 ++--- html/user/login_action.php | 25 +++++++++------------ html/user/util.inc | 21 +++++++++++++----- 8 files changed, 85 insertions(+), 32 deletions(-) create mode 100644 html/user/change_password.php diff --git a/html/user/change_password.php b/html/user/change_password.php new file mode 100644 index 0000000000..f3d20e1837 --- /dev/null +++ b/html/user/change_password.php @@ -0,0 +1,18 @@ + diff --git a/html/user/db.inc b/html/user/db.inc index 095b19f1a0..02a0dbeaf9 100644 --- a/html/user/db.inc +++ b/html/user/db.inc @@ -168,7 +168,8 @@ function show_user_profile($user) { row("Email address: ", $user->email_addr); row("Country: ", $user->country); row("Postal (ZIP) code: ", $user->postal_code); - echo "Edit User Information\n"; + echo "Edit User Information\n"; + echo "Change Password\n"; echo "\n"; } diff --git a/html/user/edit.inc b/html/user/edit.inc index 9484e86b47..5a1f210a62 100644 --- a/html/user/edit.inc +++ b/html/user/edit.inc @@ -4,19 +4,49 @@ function print_edit_user_info($user) { printf( "
\n" .TABLE2."\n" - ."".TD3.LG_FONT."User Information:\n" + ."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.\n" + ."
\n" + ."".TD2.LG_FONT."User name:\n" ); - row3("User name: ", "", $user->name); - row3("Email address: ", "", $user->email_addr); - echo "Country: ", $user->name); + echo "
\n"; + echo "".TD2.LG_FONT."Email address:\n"; + row2("", $user->email_addr); + echo "
\n"; + echo "".TD2.LG_FONT."Country:\n"; + echo "\n"; - echo "$user->country\n"; - row3("Postal (ZIP) code: ", "", $user->postal_code); + echo "$user->country\n"; + echo "
\n"; + echo "".TD2.LG_FONT."Postal (ZIP) code:\n"; + row2("", $user->postal_code); echo "\n"; echo "

       \n"; + echo ""; } +function print_change_password($user) { + printf( + "
\n" + .TABLE2."\n" + . "".TD.LG_FONT."Old Password:\n" + ."To change your password, please enter your old password below:\n" + ."\n" + ."
\n" + ."".TD.LG_FONT."New Password:\n" + ."Next, enter your new password:\n" + ."\n" + ."Retype password to confirm:" + ."\n" + ."\n" + ."

       \n" + ."
\n" + ); +} + + function print_update_ok($e_ok) { if ($e_ok == EMAIL_EXISTS) { printf( diff --git a/html/user/edit_action.php b/html/user/edit_action.php index 384aed42ce..9b388e0503 100644 --- a/html/user/edit_action.php +++ b/html/user/edit_action.php @@ -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"]; diff --git a/html/user/edit_user_info.php b/html/user/edit_user_info.php index 67bef86683..f053c017e4 100644 --- a/html/user/edit_user_info.php +++ b/html/user/edit_user_info.php @@ -12,7 +12,7 @@ print_edit_user_info($user); } else { page_head("Edit User Information"); - printf("Not Logged in. Click here to login.\n"); + echo NOLOGIN; } page_tail(); diff --git a/html/user/home.php b/html/user/home.php index 63506fe369..a4836d146b 100644 --- a/html/user/home.php +++ b/html/user/home.php @@ -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(); diff --git a/html/user/login_action.php b/html/user/login_action.php index 9c00ea2781..93c3dec28a 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -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 Back 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 Back 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" ."There's already an account with that email address. Click the Back 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" - ."You've typed two different passwords. Click the Back button on your \n" - ."browser to edit your information, making sure you type the same password in both password\n" - ." fields.\n" + ."".DIFFPASS + ."\n" ."\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" ."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" ."Couldn't create account. Please try again later.\n" diff --git a/html/user/util.inc b/html/user/util.inc index 894253d5a9..aa299bab58 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -9,6 +9,7 @@ define("EMAIL_FAIL", -2); define("LG_FONT", ""); define("SM_FONT", ""); +define("TD", ""); define("TD2", ""); define("TD3", ""); @@ -19,8 +20,16 @@ define("BG_COLOR", " bgcolor=cccccc "); define("TITLE_COLOR", " bgcolor=000000 "); define("TITLE_FONT", " "); define("BODY_COLOR", " bgcolor=ffffff "); -define("NOLOGIN", "Not logged in. Login.\n"); -define("PROJECT", "Sample Project"); +define("NOLOGIN", "Not logged in. Click here to login.\n"); +define("BADPASS", "The password you entered is incorrect. Click the Back button on your browser to re-enter your password or try again later."); +define("DIFFPASS", "You've typed two different passwords. Click the Back 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("
Log in as someone else.\n"); - printf("
My %s\n", PROJECT); + $project = get_project_name(); + printf("
My %s\n", $project); } else { echo NOLOGIN; } @@ -43,12 +53,13 @@ function show_login($user) { function page_head($title) { echo "$title\n"; - echo TABLE . "" . TITLE_FONT . "".PROJECT.": $title\n"; + $project = get_project_name(); + echo TABLE . "" . TITLE_FONT . "".$project.": $title\n"; } function page_tail() { echo "
| Create New Account | Login \n"; - echo "| User Page | Teams | Main Project Page |
\n"; + echo "| User Page | Teams | Main Project Page |\n"; } function date_str($when) {