From 24d08f51a9acab508f7ecb5e7c1307dfc5cf1f34 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 6 Dec 2002 21:37:30 +0000 Subject: [PATCH] web site fixes svn path=/trunk/boinc/; revision=700 --- html/user/create_account_action.php | 3 +- html/user/get_passwd.php | 57 +++++++++++++------------ html/user/login_form.php | 5 ++- html/user/mail_passwd.php | 15 ++++--- html/user/show_host_detail.php | 66 +++++++++++++++++++++++++++++ html/user/show_hosts.php | 41 ------------------ html/user/show_user.php | 15 +++++-- html/user/top_hosts.php | 2 +- html/user/top_teams.php | 4 +- html/user/user.inc | 30 ++++++++++--- html/user/util.inc | 9 +++- 11 files changed, 156 insertions(+), 91 deletions(-) create mode 100644 html/user/show_host_detail.php diff --git a/html/user/create_account_action.php b/html/user/create_account_action.php index bc9e449d1d..d666b4418e 100644 --- a/html/user/create_account_action.php +++ b/html/user/create_account_action.php @@ -66,5 +66,6 @@ function show_error($str) { and give it your account key.

"; - mail($new_email_addr, "Account information for ".PROJECT,"The URL for this project is \n\n".MASTER_URL."\n\nYour account key is \n\n$authenticator\n\nCopy this information into the BOINC client."); + send_auth_email($new_email_addr, $authenticator); + page_tail(); diff --git a/html/user/get_passwd.php b/html/user/get_passwd.php index 4720d85705..f602edffd8 100644 --- a/html/user/get_passwd.php +++ b/html/user/get_passwd.php @@ -3,35 +3,36 @@ require_once("util.inc"); require_once("user.inc"); -page_head("Password"); -echo "

Get your BOINC password

"; -echo "

"; -echo ""; -echo "In order to protect your account from modification by others, we require both your e-mail address and password for access. "; -echo ""; -echo "

"; -echo "
"; -echo "
"; +page_head("Account key"); +echo "

Get your ".PROJECT." account key

+

+ + In order to protect your account from modification by others, + we require both your account key for access. + +

    +
  • Do not give this account key out to anybody! If you get an + e-mail requesting your account key, please ignore it - it's not from us. +
  • The e-mail address you enter below is where we'll send the + account key. It should be the same address you enter to log into + ".PROJECT.". If they aren't the same, we cannot send the account + key for both security and administrative reasons. +
  • If your BOINC login is not a valid email address, we + unfortunately cannot help you access your account or your credits. + You will need to create a new account with a valid e-mail address + to access any future credit. +
+
+
-echo "
"; -echo "Email address: "; -echo ""; -echo "
"; -echo "
"; -echo "Your password will be sent by e-mail to the address you entered - "; -echo "you should receive it in a few minutes."; +
+ Email address: + +
+
+

+ Your account key will be sent by e-mail to the address you + entered - you should receive it in a few minutes.

"; page_tail(); diff --git a/html/user/login_form.php b/html/user/login_form.php index 9d28a2d234..591b30383b 100644 --- a/html/user/login_form.php +++ b/html/user/login_form.php @@ -5,7 +5,7 @@ echo "

@@ -16,6 +16,9 @@
- Your account ID: + Your account key:
"; + echo " + If you don't know your account key, click here.

+ "; page_tail(); ?> diff --git a/html/user/mail_passwd.php b/html/user/mail_passwd.php index 8b806c4899..43f26c2e4a 100644 --- a/html/user/mail_passwd.php +++ b/html/user/mail_passwd.php @@ -6,22 +6,25 @@ require_once("db.inc"); db_init(); page_head("Password"); -if (strlen($HTTP_POST_VARS["Submit"])) { +$email_addr = $HTTP_POST_VARS["email_addr"]; +if (strlen($email_addr)) { $query = sprintf( "select * from user where email_addr = '%s'", - $HTTP_POST_VARS["email_addr"] + $email_addr ); $result = mysql_query($query); $user = mysql_fetch_object($result); mysql_free_result($result); - mail($user->email_addr, "BOINC password", "Your BOINC password is " . $user->web_password); + send_auth_email($user->email_addr,$user->authenticator); } if (!$user) { - echo "There is no user with that password. "; - echo "Try reentering your email address."; + echo "There is no user with that password.
+ Try reentering your email address.

"; +} else { + echo "Your account key has been emailed to ".$email_addr.".

"; } page_tail(); -?> \ No newline at end of file +?> diff --git a/html/user/show_host_detail.php b/html/user/show_host_detail.php new file mode 100644 index 0000000000..2dc53dc222 --- /dev/null +++ b/html/user/show_host_detail.php @@ -0,0 +1,66 @@ +".TD2.LG_FONT."Host Information:\n"; + row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); + row("Domain name: ", $host->domain_name); + $x = $host->timezone/3600; + row("Time zone: ", "UTC - $x hours"); + row("Created: ", time_str($host->create_time)); + row("Total Credit:", $host->total_credit); + row("Recent average credit:", $host->expavg_credit); + row("CPU: ", "$host->p_vendor $host->p_model"); + row("Number of CPUs: ", $host->p_ncpus); + row("Operating System: ", "$host->os_name $host->os_version"); + $x = $host->m_nbytes/(1024*1024); + $y = round($x, 2); + row("Memory: ", "$y MB"); + $x = $host->m_cache/1024; + $y = round($x, 2); + row("Cache: ", "$y KB"); + $x = $host->m_swap/(1024*1024); + $y = round($x, 2); + row("Swap Space: ", "$y MB"); + $x = $host->d_total/(1024*1024*1024); + $y = round($x, 2); + row("Total Disk Space: ", "$y GB"); + $x = $host->d_free/(1024*1024*1024); + $y = round($x, 2); + row("Free Disk Space: ", "$y GB"); + row("Avg upload speed:", "$host->n_bwup bytes/sec"); + row("Avg download speed:
", "$host->n_bwdown bytes/sec"); + row("Number of times client has contacted server: ", $host->rpc_seqno); + row("Last time contacted server: ", time_str($host->rpc_time)); + row("% of time client on: ", 100*$host->on_frac." %"); + row("% of time host connected: ", 100*$host->connected_frac." %"); + row("% of time user active: ", 100*$host->active_frac." %"); + echo "\n"; + +} + $authenticator = init_session(); + db_init(); + $user = get_user_from_auth($authenticator); + $hostid = $HTTP_GET_VARS["hostid"]; + if ($user && $hostid) { + page_head("Host stats"); + + $result = mysql_query("select * from host where id = $hostid and userid = $user->id"); + $host = mysql_fetch_object($result); + mysql_free_result($result); + + if ($host) { + show_host($host); + } else { + echo "Couldn't find host or user.

"; + } + page_tail(); + } else { + print_login_form(); + } +?> diff --git a/html/user/show_hosts.php b/html/user/show_hosts.php index b946635006..da73cc0dad 100644 --- a/html/user/show_hosts.php +++ b/html/user/show_hosts.php @@ -4,47 +4,6 @@ require_once("db.inc"); require_once("user.inc"); -function show_host($host) { - - echo TABLE2."\n"; - echo "Below is information on all the hosts you have running the BOINC core client."; - echo "

"; - echo "".TD2.LG_FONT."Host Information:\n"; - row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); - row("Domain name: ", $host->domain_name); - $x = $host->timezone/3600; - row("Time zone: ", "UTC - $x hours"); - row("Created: ", time_str($host->create_time)); - row("Total Credit:", $host->total_credit); - row("Recent average credit per day:", $host->expavg_credit); - row("CPU: ", "$host->p_vendor $host->p_model"); - row("Number of CPUs: ", $host->p_ncpus); - row("Operating System: ", "$host->os_name $host->os_version"); - $x = $host->m_nbytes/(1024*1024); - $y = round($x, 2); - row("Memory: ", "$y MB"); - $x = $host->m_cache/1024; - $y = round($x, 2); - row("Cache: ", "$y KB"); - $x = $host->m_swap/(1024*1024); - $y = round($x, 2); - row("Swap Space: ", "$y MB"); - $x = $host->d_total/(1024*1024*1024); - $y = round($x, 2); - row("Total Disk Space: ", "$y GB"); - $x = $host->d_free/(1024*1024*1024); - $y = round($x, 2); - row("Free Disk Space: ", "$y GB"); - row("Avg network bandwidth:
(upstream)
", "$host->n_bwup bytes/sec"); - row("Avg network bandwidth:
(downstream)
", "$host->n_bwdown bytes/sec"); - row("Number of times client has contacted server: ", $host->rpc_seqno); - row("Last time contacted server: ", time_str($host->rpc_time)); - row("% of time client on: ", 100*$host->on_frac." %"); - row("% of time host connected: ", 100*$host->connected_frac." %"); - row("% of time user active: ", 100*$host->active_frac." %"); - echo "\n"; - -} $authenticator = init_session(); db_init(); $user = get_user_from_auth($authenticator); diff --git a/html/user/show_user.php b/html/user/show_user.php index abd90bfd79..85e7616fad 100644 --- a/html/user/show_user.php +++ b/html/user/show_user.php @@ -3,14 +3,21 @@ require_once("user.inc"); require_once("db.inc"); - $authenticator = init_session(); + init_session(); db_init(); - $user = get_user_from_auth($authenticator); + $id = $HTTP_GET_VARS["id"]; + + $result = mysql_query("select * from user where id = $id"); + $user = mysql_fetch_object($result); + mysql_free_result($result); + if ($user) { page_head("User stats"); - show_user($user); + show_user_stats($user); page_tail(); } else { - print_login_form(); + page_head("Can't find user"); + echo "There is no account with that id.\n

"; + page_tail(); } ?> diff --git a/html/user/top_hosts.php b/html/user/top_hosts.php index cf203d8232..f3cc73d62a 100644 --- a/html/user/top_hosts.php +++ b/html/user/top_hosts.php @@ -14,7 +14,7 @@ EOT; } function show_host_row($host) { - $result = mysql_query("select * from user where id = $host->id"); + $result = mysql_query("select * from user where id = $host->userid"); $user = mysql_fetch_object($result); mysql_free_result($result); echo " diff --git a/html/user/top_teams.php b/html/user/top_teams.php index 9fd21cc19b..de5aaedb40 100644 --- a/html/user/top_teams.php +++ b/html/user/top_teams.php @@ -3,7 +3,7 @@ require_once("user.inc"); function team_table_start() { - echo TABLE." + echo VISTABLE." NameAverage creditTotal credit Founded"; } @@ -50,6 +50,6 @@ function show_team_row($team) { show_team_row($team); } mysql_free_result($result); - echo "\n"; + echo "\n

\n"; page_tail(); ?> diff --git a/html/user/user.inc b/html/user/user.inc index 39e5fe9ed3..af9624bba5 100644 --- a/html/user/user.inc +++ b/html/user/user.inc @@ -1,6 +1,9 @@ ".TD2.LG_FONT."User Stats:\n"; + row("User Name: ", $user->name); $row = sprintf("%s user since: ", $project); row($row, time_str($user->create_time)); row("Total credit: ", $user->total_credit); @@ -10,32 +13,47 @@ function show_user_stats($user) { $team = mysql_fetch_object($result); row("Team: ", "id>$team->name"); } else { - row("Team: ", "none"); + row("Team: ", "None"); } + echo "\n"; } function show_user_profile($user) { + echo TABLE2."\n"; + echo "".TD2.LG_FONT."User Information:\n"; row("name", $user->name); - row("email address", $user->email_addr); + row("email address", $user->email_addr); row("country", $user->country); row("postal (ZIP) code", $user->postal_code); - echo "Edit the above information\n"; + echo "Edit user information\n"; if (1) { echo "
\n"; } else { echo "Change Password\n"; } + echo "\n"; } function show_hosts($user) { - $result = mysql_query("select * from host where userid=$user->id"); + $result = mysql_query("select * from host where userid=$user->id order by rpc_time desc"); + echo VISTABLE."\n"; + echo "Host nameTotal CreditRecent credit"; while ($host = mysql_fetch_object($result)) { echo "

\n"; - show_host($host); + show_host_brief($host); } + echo "\n"; mysql_free_result($result); } +function show_host_brief($host) { + echo " + id>$host->domain_name + $host->total_credit + $host->expavg_credit + "; +} + // show a summary of the user. // NOTE: This is intended to be shown only to that user. // it has info that other users aren't supposed to see @@ -53,7 +71,7 @@ function show_user_page_private($user) { } function user_table_start() { - echo TABLE." + echo VISTABLE." NameAverage creditTotal credit Participant since"; } diff --git a/html/user/util.inc b/html/user/util.inc index 2d79a8509d..a6f1bb8308 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -14,6 +14,7 @@ define("TD2", ""); define("TD3", ""); define("TABLE", ""); +define("VISTABLE", "
"); define("TABLE2", "
"); define("BG_COLOR", " bgcolor=ffffff "); @@ -23,6 +24,12 @@ define("BODY_COLOR", " bgcolor=ffffff "); define("PROJECT", "Astropulse"); define("MASTER_URL", "http://maggie.ssl.berkeley.edu/ap/"); +// Sends the authenticator to the given email address +function send_auth_email($email_addr, $auth) { + mail($email_addr, "Account information for ".PROJECT, + "The URL for this project is \n\n".MASTER_URL."\n\nYour account key is \n\n$auth\n\nCopy this information into the BOINC client."); +} + // Initializes the session and returns the authenticator // for the session (if any) function init_session() { @@ -71,7 +78,7 @@ function page_tail() { // put your copyright notice etc. here - echo "
Copyright (c) 2002 ".PROJECT."\n"; + echo "
Copyright (c) 2002 Sample Project\n"; } function date_str($when) {