web site fixes

svn path=/trunk/boinc/; revision=700
This commit is contained in:
David Anderson 2002-12-06 21:37:30 +00:00
parent 27e22063e0
commit 24d08f51a9
11 changed files with 156 additions and 91 deletions

View File

@ -66,5 +66,6 @@ function show_error($str) {
and give it your account key.
<p>";
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();

View File

@ -3,35 +3,36 @@
require_once("util.inc");
require_once("user.inc");
page_head("Password");
echo "<h2>Get your BOINC password</h2>";
echo "<p>";
echo "<b>";
echo "In order to protect your account from modification by others, we require both your e-mail address and password for access. ";
echo "</b>";
echo "<ul>";
echo "<li>Do not give this password out to anybody! ";
echo "If you get an e-mail requesting ";
echo "your password, please ignore it - it's not from us. ";
echo "<li>The e-mail address you enter below is where we'll send the password. ";
echo "It should be the same address you enter to log into BOINC. ";
echo "If they aren't the same, we cannot send the password for both ";
echo "security and administrative reasons. ";
echo "<li>If your BOINC login is not a valid email address, ";
echo "we unfortunately cannot help you access your account or your credits. ";
echo "You will need to create a new account with a valid e-mail address ";
echo "to access any future credit. ";
echo "</ul>";
echo "<br clear=all>";
echo "<table width=600 border=0 cellpadding=0 cellspacing=0><tr><td>";
page_head("Account key");
echo "<h2>Get your ".PROJECT." account key</h2>
<p>
<b>
In order to protect your account from modification by others,
we require both your account key for access.
</b>
<ul>
<li>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.
<li>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.
<li>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.
</ul>
<br clear=all>
<table width=600 border=0 cellpadding=0 cellspacing=0><tr><td>
echo "<form action=mail_passwd.php>";
echo "Email address: <input name=email_addr>";
echo "<input type=submit value=Submit>";
echo "</form>";
echo "</table>";
echo "Your password will be sent by e-mail to the address you entered - ";
echo "you should receive it in a few minutes.";
<form method=post action=mail_passwd.php>
Email address: <input name=email_addr>
<input type=submit value=Submit>
</form>
</table>
<p>
Your account key will be sent by e-mail to the address you
entered - you should receive it in a few minutes.<p>";
page_tail();

View File

@ -5,7 +5,7 @@
echo "<form method=post action=login_action.php>
<table cellpadding=8>
<tr><td align=right>
Your account ID:
Your account key:
</td><td>
<input name=authenticator size=40>
</td></tr>
@ -16,6 +16,9 @@
<input type=submit value='Log in'>
</td></tr>
</table>";
echo "<font size=1>
If you don't know your account key, <a href=get_acct_key.php>click here</a>.<p>
</font>";
page_tail();
?>

View File

@ -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. <br>
Try reentering your email address.<p>";
} else {
echo "Your account key has been emailed to ".$email_addr.".<p>";
}
page_tail();
?>
?>

View File

@ -0,0 +1,66 @@
<?php
require_once("util.inc");
require_once("user.inc");
require_once("db.inc");
require_once("user.inc");
function show_host($host) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>Host Information:</b></font></td></tr>\n";
row("<b>IP address: </b>", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
row("<b>Domain name: <b>", $host->domain_name);
$x = $host->timezone/3600;
row("<b>Time zone: </b>", "UTC - $x hours");
row("<b>Created: </b>", time_str($host->create_time));
row("<b>Total Credit:</b>", $host->total_credit);
row("<b>Recent average credit:</b>", $host->expavg_credit);
row("<b>CPU: </b>", "$host->p_vendor $host->p_model");
row("<b>Number of CPUs: </b>", $host->p_ncpus);
row("<b>Operating System: </b>", "$host->os_name $host->os_version");
$x = $host->m_nbytes/(1024*1024);
$y = round($x, 2);
row("<b>Memory: </b>", "$y MB");
$x = $host->m_cache/1024;
$y = round($x, 2);
row("<b>Cache: </b>", "$y KB");
$x = $host->m_swap/(1024*1024);
$y = round($x, 2);
row("<b>Swap Space: </b>", "$y MB");
$x = $host->d_total/(1024*1024*1024);
$y = round($x, 2);
row("<b>Total Disk Space: </b>", "$y GB");
$x = $host->d_free/(1024*1024*1024);
$y = round($x, 2);
row("<b>Free Disk Space: </b>", "$y GB");
row("<b>Avg upload speed:</b>", "$host->n_bwup bytes/sec");
row("<b>Avg download speed:<br></b>", "$host->n_bwdown bytes/sec");
row("<b>Number of times client has contacted server: </b>", $host->rpc_seqno);
row("<b>Last time contacted server: </b>", time_str($host->rpc_time));
row("<b>% of time client on: </b>", 100*$host->on_frac." %");
row("<b>% of time host connected: </b>", 100*$host->connected_frac." %");
row("<b>% of time user active: </b>", 100*$host->active_frac." %");
echo "</table>\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.<p>";
}
page_tail();
} else {
print_login_form();
}
?>

View File

@ -4,47 +4,6 @@
require_once("db.inc");
require_once("user.inc");
function show_host($host) {
echo TABLE2."\n";
echo "<tr>Below is information on all the hosts you have running the BOINC core client.";
echo "<p>";
echo "<tr>".TD2.LG_FONT."<b>Host Information:</b></font></td></tr>\n";
row("<b>IP address: </b>", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
row("<b>Domain name: <b>", $host->domain_name);
$x = $host->timezone/3600;
row("<b>Time zone: </b>", "UTC - $x hours");
row("<b>Created: </b>", time_str($host->create_time));
row("<b>Total Credit:</b>", $host->total_credit);
row("<b>Recent average credit per day:</b>", $host->expavg_credit);
row("<b>CPU: </b>", "$host->p_vendor $host->p_model");
row("<b>Number of CPUs: </b>", $host->p_ncpus);
row("<b>Operating System: </b>", "$host->os_name $host->os_version");
$x = $host->m_nbytes/(1024*1024);
$y = round($x, 2);
row("<b>Memory: </b>", "$y MB");
$x = $host->m_cache/1024;
$y = round($x, 2);
row("<b>Cache: </b>", "$y KB");
$x = $host->m_swap/(1024*1024);
$y = round($x, 2);
row("<b>Swap Space: </b>", "$y MB");
$x = $host->d_total/(1024*1024*1024);
$y = round($x, 2);
row("<b>Total Disk Space: </b>", "$y GB");
$x = $host->d_free/(1024*1024*1024);
$y = round($x, 2);
row("<b>Free Disk Space: </b>", "$y GB");
row("<b>Avg network bandwidth:<br>(upstream) </b>", "$host->n_bwup bytes/sec");
row("<b>Avg network bandwidth:<br>(downstream) </b>", "$host->n_bwdown bytes/sec");
row("<b>Number of times client has contacted server: </b>", $host->rpc_seqno);
row("<b>Last time contacted server: </b>", time_str($host->rpc_time));
row("<b>% of time client on: </b>", 100*$host->on_frac." %");
row("<b>% of time host connected: </b>", 100*$host->connected_frac." %");
row("<b>% of time user active: </b>", 100*$host->active_frac." %");
echo "</table>\n";
}
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);

View File

@ -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<p>";
page_tail();
}
?>

View File

@ -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 "<tr>

View File

@ -3,7 +3,7 @@
require_once("user.inc");
function team_table_start() {
echo TABLE."
echo VISTABLE."
<tr><th>Name</th><th>Average credit</th><th>Total credit</th>
<th>Founded</th></tr>";
}
@ -50,6 +50,6 @@ function show_team_row($team) {
show_team_row($team);
}
mysql_free_result($result);
echo "</table>\n";
echo "</table>\n<p>\n";
page_tail();
?>

View File

@ -1,6 +1,9 @@
<?php
function show_user_stats($user) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User Stats:</b></font></td></tr>\n";
row("<b>User Name: </b>", $user->name);
$row = sprintf("<b>%s user since: </b>", $project);
row($row, time_str($user->create_time));
row("<b>Total credit: </b>", $user->total_credit);
@ -10,32 +13,47 @@ function show_user_stats($user) {
$team = mysql_fetch_object($result);
row("<b>Team: </b>", "<a href=team_display.php?id=$team->id>$team->name</a>");
} else {
row("<b>Team: </b>", "none");
row("<b>Team: </b>", "None");
}
echo "</table>\n";
}
function show_user_profile($user) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User Information:</b></font></td></tr>\n";
row("<b>name</b>", $user->name);
row("<b>email address<b>", $user->email_addr);
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><font size=-1>Edit the above information</font></a></td>\n";
echo "<tr><td align=right><a href=edit_user_info.php>Edit user information</a></td>\n";
if (1) {
echo "<td><br></td></tr>\n";
} else {
echo "<td align=center><a href=change_password.php>Change Password</a></td></tr>\n";
}
echo "</table>\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 "<tr><td>Host name</td><td>Total Credit</td><td>Recent credit</td></tr>";
while ($host = mysql_fetch_object($result)) {
echo "<p>\n";
show_host($host);
show_host_brief($host);
}
echo "</table>\n";
mysql_free_result($result);
}
function show_host_brief($host) {
echo "<tr>
<td><a href=show_host_detail.php?hostid=$host->id>$host->domain_name</a></td>
<td>$host->total_credit</td>
<td>$host->expavg_credit</td>
</tr>";
}
// 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."
<tr><th>Name</th><th>Average credit</th><th>Total credit</th>
<th>Participant since</th></tr>";
}

View File

@ -14,6 +14,7 @@ define("TD2", "<td colspan=2 bgcolor=cccccc>");
define("TD3", "<td colspan=3 bgcolor=cccccc>");
define("TABLE", "<table cellpadding=10 cellspacing=4 border=0 width=100%>");
define("VISTABLE", "<table cellpadding=2 cellspacing=0 border=1 width=100%>");
define("TABLE2", "<table width=580>");
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 "<hr>Copyright (c) 2002 ".PROJECT."\n";
echo "<hr>Copyright (c) 2002 Sample Project\n";
}
function date_str($when) {