Changed home page to a php file to check for cookies, added expanatory text on front page and on team pages

svn path=/trunk/boinc/; revision=294
This commit is contained in:
Barry Luong 2002-08-12 20:16:55 +00:00
parent 05b2a28785
commit 2ec5515b93
16 changed files with 246 additions and 240 deletions

View File

@ -5,9 +5,9 @@ include_once("util.inc");
include_once("login.inc");
include_once("prefs.inc");
$project = db_init();
$head = sprintf("Create User Account for %s", $project);
page_head($head);
db_init();
page_head("Create Account");
print_create_account_form();
page_tail();

View File

@ -10,18 +10,13 @@ function db_init() {
$db_name = rtrim($db_name);
mysql_select_db($db_name);
fclose($fp);
return $db_name;
}
function lookup_user_auth($auth) {
$result = mysql_query("select * from user where authenticator='$auth'");
if ($result) {
$user = mysql_fetch_object($result);
mysql_free_result($result);
return $user;
} else {
return 0;
}
$user = mysql_fetch_object($result);
mysql_free_result($result);
return $user;
}
function show_platform($platform) {
@ -144,32 +139,18 @@ function show_result($result) {
echo "</table>";
}
function show_user_stats($user, $project) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User Stats:</b></font></td></tr>\n";
row("<b>User ID: </b>", $user->id);
$row = sprintf("<b>%s user since: </b>", $project);
row($row, time_str($user->create_time));
row("<b>Total credit: </b>", $user->total_credit);
row("<b>Recent averaged credit: </b>", $user->expavg_credit);
if ($user->teamid) {
$result = mysql_query("select * from team where id = $user->teamid");
$team = mysql_fetch_object($result);
row("<b>Member of team: </b>", "<a href=team_display.php?id=$team->id>$team->name</a>");
} else {
row("<b>Member of team: </b>", "You are currently not part of a team");
}
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>User name: </b>", $user->name);
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";
function show_user($user) {
start_table();
row("ID", $user->id);
row("created", time_str($user->create_time));
row("name", $user->name);
row("email_addr", $user->email_addr);
row("country", $user->country);
row("postal_code", $user->postal_code);
row("total credit", $user->total_credit);
row("recent average credit", $user->expavg_credit);
row("preferences", "<pre>".htmlspecialchars($user->prefs)."</pre>");
row("prefs mod time", time_str($user->prefs_mod_time));
echo "</table>\n";
}

View File

@ -4,16 +4,12 @@
require_once("db.inc");
require_once("login.inc");
$project = db_init();
db_init();
$user = get_user_from_cookie();
if ($user) {
$head = sprintf("%s's User Page for %s", $user->name, $project);
page_head($head);
show_user_page($user, $project);
page_head("User Home");
show_user_page($user);
} else {
$head = sprintf("Login to %s", $project);
page_head($head);
print_login_form();
}
page_tail();

52
html/user/index.php Normal file
View File

@ -0,0 +1,52 @@
<head>
<title>Sample Distributed Computing Project</title>
</head>
<body text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000>
<h1>Sample Distributed Computing Project</h1>
<?php
require_once("util.inc");
require_once("db.inc");
db_init();
$user = get_user_from_cookie();
if ($user) {
echo "<h3>Welcome $user->name</h3>";
echo "If you are not $user->name or would wish to log in as another user ";
echo "<a href=login.php>Login here</a>.";
}
?>
<p>
This distribued computing project is running on the BOINC software platform. BOINC is a software platform for public-participation distributed computing projects. Users are allowed
to simultaneously participate in multiple projects and to choose how to allocate their resources
for each project.
<h3>Joining this project</h3>
First, <a href=create_account.php>create an account</a>, setting your preferences to specify how much your computer should be
working on this project. You may view your user page to see how much credit you have accumulated as your
participation proceeds. In addition, you may update your user information or modify your preferences
through your user page at anytime to reallocate your resources among the different projects you may
be involved in.
<p>
When creating you account the project will send you an authenticator to the email specified. After successfully
creating an account <a href=download.php>download the core client</a>. In order to run the core client you must cut and paste in the
authenticator provided in the email sent to you by the project.
<h3>Joining other projects</h3>
When you join subsequent projects make sure to edit your project preferences for your home project
(the first BOINC supported project you joined) accordingly. You will need to update project preferences with each new project you join. You will be asked to provide the authenticator for each
project so make sure to cut and paste those in from the emails sent to you. This will inform other projects
of the other projects you are involved in, allowing you to participate in all of them simultaneously.
<p>
If this is not the first project you are joining, make sure to edit the project preferences of your home
project.
<ul>
<li><a href=create_account.php>Create account</a></li>
<li><a href=download.php>Download core client</a></li>
<li><a href=login.php>Log in</a></li>
<li><a href=home.php>User home page</a></li> - view stats, modify preferences
<li><a href=team.php>Teams</a></li> - join sample distributed project community
</ul>
<scheduler>http://maggie.ssl.berkeley.edu/barry-cgi/cgi</scheduler>
</body>

View File

@ -3,11 +3,10 @@
function print_login_form() {
printf(
"<form method=post action=login_action.php>\n"
.TABLE2."\n"
."<tr><td colspan=2><b>Enter the email address and password of your account to login:</b></td></tr>\n"
."<tr><td><br></td></tr>\n"
."<table>\n"
."<tr><td colspan=2>If you already have an account:</td></tr>\n"
."<tr>\n"
." <td align=right>Email Address</td>\n"
." <td align=right>Email</td>\n"
." <td> <input name=existing_email type=text size=40></td>\n"
."</tr>\n"
."<tr>\n"
@ -20,48 +19,37 @@ function print_login_form() {
."</tr>\n"
."</table>\n"
."</form>\n"
."<table>\n"
."<tr><td colspan=2>If you don't have an account:</td></tr>\n"
."<tr><td><a href=create_account.php>Create a new account</a></td></tr>\n"
."</table>\n"
);
}
function print_create_account_form() {
printf(
"<form method=post action=login_action.php>\n"
.TABLE2."\n"
."<tr><td><b>To create a new account, please fill out the following information:</b></td></tr>\n"
."<tr><td><br></td></tr>\n"
."<table>\n"
."<tr><td colspan=2>To create a new account:</td></tr>\n"
."<tr>\n"
." <td><b>Name or nickname:</b>".SM_FONT." this is the name that will be seen by other users on the web.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td align=right>Name or nickname</td>\n"
." <td><input name=new_name size=30></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Email address:</b>".SM_FONT." this is what you will be using to login to your account. The address you enter\n"
."must be valid in order for you to create an account; a unique BOINC key will be sent to it to make sure it is valid.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=new_email_addr size=50></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Password:</b>".SM_FONT." remember this password - you may need it to access your account in the future.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td align=right>Password</td>\n"
." <td><input name=new_password type=password></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Retype password to confirm:</b></td>\n"
."</tr>\n"
."<tr>\n"
." <td align=right>Password confirm</td>\n"
." <td><input name=new_password2 type=password></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Country:</b>".SM_FONT." select from the list below the country you wish to represent.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td align=right>Email</td>\n"
." <td><input name=new_email_addr size=40></td>\n"
."</tr>\n"
."<tr>\n"
." <td align=right>Country</td>\n"
." <td><select name=country>\n"
);
@ -70,15 +58,12 @@ function print_create_account_form() {
" </select>\n"
." </td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Postal (ZIP) code:</b></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=postal_code size=20></td>\n"
." <td align=right>Postal (ZIP) code</td>\n"
." <td><input name=postal_code size=40></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><br></td>\n"
." <td><input type=submit name=new value=\"Create account\"></td>\n"
."</tr>\n".
"</table>\n"

View File

@ -1,8 +1,7 @@
<?php
require_once("util.inc");
require_once("login.inc");
$head = sprintf("Login to %s", db_init());
page_head($head);
db_init();
page_head("Log in");
print_login_form();
page_tail();
?>

View File

@ -3,7 +3,7 @@
require_once("user.inc");
require_once("db.inc");
$project = db_init();
db_init();
if (strlen($HTTP_POST_VARS["old"])) {
$query = sprintf(
"select * from user where email_addr='%s'",
@ -15,17 +15,14 @@
mysql_free_result($result);
}
if (!$user or ($user->web_password != $HTTP_POST_VARS["existing_password"])) {
$head = sprintf("Logging in to %s", $project);
page_head($head);
page_head("Logging In");
echo "We have no account with that name and password.";
} else {
setcookie("auth", $user->authenticator, time()+100000000);
$head = sprintf("%s User Page", $project);
page_head($head);
show_user_page($user, $project);
page_head("User home");
show_user_page($user);
}
} 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"]
@ -36,24 +33,12 @@
mysql_free_result($result);
}
if ($user) {
page_head($head);
printf(
TABLE2."\n"
."<tr><td>There's already an account with that email address. Click the <b>Back</b> button\n"
." on your browser to edit your information, or <a href=login.php>login </a>to your \n"
.$project." account.</td></tr>\n"
."</table>\n"
);
page_head("Creating Account");
echo "There's already an account with that email address.";
} else {
if ($HTTP_POST_VARS["new_password"] != $HTTP_POST_VARS["new_password2"]) {
page_head($head);
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"
."</table>\n"
);
page_head("Creating Account");
echo "You've typed two different passwords.";
} else {
$authenticator = random_string();
$email_addr = $HTTP_POST_VARS["new_email_addr"];
@ -70,24 +55,12 @@
$result = mysql_query($query);
if ($result) {
setcookie("auth", $authenticator);
page_head($head);
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"
."the email address you provided, and you can simply copy and paste the key, which will be a string of letters and numbers, \n"
."in the location indicated when you run the client.</td></tr>\n"
."<tr><td><br><br></td></tr>\n"
."<tr><td><a href=download.php>Download core client</a></td></tr>\n"
."</table>\n"
);
page_head("Creating Account");
echo "Account created. You are being mailed a key that you'll need to run the client.\n";
mail($email_addr, "BOINC key", "Your BOINC key is " . $authenticator);
} else {
page_head($head);
printf(
TABLE2."\n"
."<tr><td>Couldn't create account. Please try again later.</td></tr>\n"
."</table>\n"
);
page_head("Creating Account");
echo "Couldn't create account - please try later.\n";
}
}
}

View File

@ -8,17 +8,34 @@ function print_teams_display() {
page_head("Teams");
echo "<h2>BOINC Teams</h2>";
echo "<p>";
echo "BOINC users can form &quot;teams&quot; - ";
echo "for example, students in a school, employees of a company. ";
echo "<br>";
echo "Teams can compete to analyze the most data, ";
echo "or they can meet and discuss BOINC projects via the web.";
echo "BOINC users may form &quot;teams&quot; - ";
echo "for example, students in a school, employees of a company, etc. ";
echo "<p>";
echo "Teams may compete against other teams to analyze the most data, ";
echo "or they may meet and discuss BOINC projects via the web. ";
echo "Team members may view their individual records and compare ";
echo "personals statistics with other team members' statistics, in addition ";
echo "to viewing their team's total statistics on the team's statistics page.";
echo "<p>";
echo "<br>";
echo "To create a team click on the below link. ";
echo "Team founder's have more privileges than normal team members.";
echo "<p>";
echo "<a href=team_create_form.php>Create a new team</a>";
echo "<p>";
echo "<br>";
echo "<br>";
echo "To search for a team type in the team name below and hit the Search button. ";
echo "You may join teams through these team pages.";
echo "<p>";
echo "It may be more effective to type in only a portion of the team name ";
echo "and choose from the search results in order to assure ";
echo "that you do not overlook a variation of the team. ";
echo "(i.e. If you work for a team affiliated with Apple Computer, Inc. it will be more effective ";
echo "to search for \"Apple\" and to choose fromt eh search results than to search for the entire name of the company.)";
echo "<p>";
echo "<form method=post action=team_lookup.php>";
echo "Search for a team named: ";
echo "Search for a team: ";
echo "<input name=team_name>";
echo "<input type=submit name=search value=\"Search\">";
echo "</form>";
@ -40,13 +57,23 @@ echo "<a href=team_disband_form.php?id=$team->id><b>Disband Team*</b></a> | ";
echo "<a href=team_email_list.php?id=$team->id><b>View Team Emails*</b></a>";
echo "<br><font size=2>* Team founder only</font>";
echo "<p><b>Note: </b>Ocasionally the daily scripts that create this file fail ";
echo "to generate each page correctly. If you think this has happened, then the ";
echo "founder of this team can regenerate this file at any time by doing the following:";
echo "<ul>";
echo "<li>Click on &quot;Edit&quot;.";
echo "<li>Click on the &quot;Edit Team&quot; button at the bottom of that page.";
echo "<li>Anyone may join a team at any time.</li>";
echo "<li>Likewise, anyone may quit a team at any time.</li>";
echo "<li>Only the team founder may edit a team's fields (i.e. name, html code, ";
echo "description, etc.).</li>";
echo "<li>In addition, team founder's have the right of removing inactive members ";
echo "from a team.</li>";
echo "<li>Only the team founder may disband a team, however, in order to successfully disband a ";
echo "team all members of the team must no longer be members of the team, including the team founder. ";
echo "Then the team founder may go to the team page and disband the team. ";
echo "A team may not be disbanded if it still has members.</li>";
echo "<li>Finally, the team founder has access to all team members' email addresses.</li>";
echo "</ul>";
echo "<br>";
echo "<p>";
echo "<b><p>Team Info</p></b>";
echo "<table border=1>";
if (strlen($team->description)) {
echo "<tr><td>Description</td><td>$team->description</td></tr>";
@ -76,7 +103,7 @@ $query = sprintf(
$result = mysql_query($query);
$user = mysql_fetch_object($result);
echo "$user->name</td></tr>";
echo "</table><p>Team Members:</p>";
echo "</table><b><p>Team Members:</b></p>";
echo "<table border=\"1\" cellspacing=0 cellpadding=2><tr>";
echo "<th>Name</th>";
echo "<th>Total<br>Credit</th>";
@ -111,7 +138,7 @@ echo "<p>";
echo "Use this form to create a team. ";
echo "You'll become the first member of the team. ";
echo "Then tell your friends/co-workers/etc. about the team. ";
echo "They can join it using the BOINC &quot;Teams&quot; page. ";
echo "They may join it using the BOINC &quot;Teams&quot; page. ";
echo "<p>";
echo "<form method=post action=team_create_action.php>";
echo "<table>";
@ -124,7 +151,7 @@ echo "</td>";
echo "</tr><tr>";
echo "<td>Team name (HTML version):<br><br>&nbsp;</td>";
echo "<td><input name=name_html size=60>";
echo "<br><font size=2>This name will be printed as HTML source, so you can include any HTML";
echo "<br><font size=2>This name will be printed as HTML source, so you may include any HTML";
echo "<br>code that you want. This will only be displayed in your teams' page.";
echo "<br>If you don't know HTML, just leave this box blank.";
echo "</td>";
@ -187,6 +214,7 @@ echo "all of your credits, the old teams total will be decreased by ";
echo "your credit amount.";
echo "<li>Joining a team does not affect your personal credit ";
echo "statistics in any way.";
echo "<li>Joining a team gives your team's founder access to your email address.";
echo "</ul>";
echo "</p>";
echo "<hr>";
@ -249,7 +277,7 @@ page_head("Edit $team_name");
echo "<h2>Edit $team_name</h2>";
echo "<p><b>Please note before editing a team:</b>";
echo "<ul>";
echo "<li>Only the founder can edit a team";
echo "<li>Only the founder may edit a team";
echo "</ul>";
echo "</p>";
echo "<hr>";
@ -263,12 +291,14 @@ echo "<br>and is the name you should use when searching for your team.";
echo "</td></tr></tr>";
echo "<td>Team name (HTML version):<br><br>&nbsp;</td>";
echo "<td><input name=name_html size=60 value='$team_name_html'>";
echo "<br><font size=2>This name will be printed as HTML source, so you can include any HTML";
echo "<br>code that you want. This will only be displayed in your teams' page.";
echo "<br><font size=2>This name will be printed as HTML source, so you may include any HTML";
echo "<br>code that you want. This will only be displayed in your team's page.";
echo "<br>If you don't know HTML, just leave this box blank.";
echo "</td></tr><tr>";
echo "<td>URL of team web page, if any:<br><font size=2>(without &quot;http://&quot;)</td>";
echo "<td><input name=url size=60 value=$team_url></td></tr><tr>";
echo "<td><input name=url size=60 value=$team_url>";
echo "<br><font size=2>This page will be linked to from the project's team page.";
echo "</td></tr><tr>";
echo "<td valign=top>Description of team:</td>";
echo "<td><textarea name=description value=$team_description cols=60 rows=10>$team_description</textarea>";
echo "</td></tr><tr>";
@ -305,11 +335,9 @@ page_head("Remove Members from $team_name");
echo "<h2>Remove members from $team_name</h2>";
echo "<p><b>Please note:</b>";
echo "<ul>";
echo "<li>Only the founder can remove members from a team";
echo "<li>Only the founder may remove members from a team";
echo "<li>By removing a member, you will also remove their credit and CPU time ";
echo "contributions to the team.";
echo "<li>Team members may only be removed if they have been inactive for ";
echo "more than two weeks.";
echo "</ul>";
echo "</p>";
echo "<hr>";
@ -319,7 +347,6 @@ echo "<br></td></tr></table>";
echo "<table border=1><tr><th>Remove?</th>";
echo "<th>Name</th>";
echo "<th>Total<br>Credit</th>";
echo "<th>Inactive Since</th></tr>";
$query = sprintf(
"select * from user where teamid = %d",
@ -330,14 +357,10 @@ $result = mysql_query($query);
$ninactive_users = 0;
for ($i = 0; $i < $nusers; $i++) {
$user = mysql_fetch_object($result);
if ((time() - $user->inactive_since) > 1209600) {
// 1209600 is the number of seconds in two weeks
echo "<tr><td align=center><input type=checkbox name=remove_$ninactive_users value=$user->id>";
echo "<td>$user->name</td>";
echo "<td>$user->total_credit</td>";
echo "<td>$user->inactive_since</td>";
$ninactive_users++;
}
echo "<tr><td align=center><input type=checkbox name=remove_$ninactive_users value=$user->id>";
echo "<td>$user->name</td>";
echo "<td>$user->total_credit</td>";
$ninactive_users++;
}
echo "<input type=hidden name=ninactive_users value=$ninactive_users>";
if ($result) {
@ -365,10 +388,10 @@ page_head("Disband $team_name");
echo "<h2>Disband $team_name</h2>";
echo "<p><b>Please note:</b>";
echo "<ul>";
echo "<li>Only the found can disband a team.";
echo "<li>Only teams with no members can be disbanded. The founder of a team ";
echo "<li>Only the found may disband a team.";
echo "<li>Only teams with no members may be disbanded. The founder of a team ";
echo "may email the members of a team to inform them of the disbanding of the team.";
echo "<li>After a team is disbanded, all memeber will no longer belong to a team, ";
echo "<li>After a team is disbanded, all members will no longer belong to a team, ";
echo "though they may join another team if desired.";
echo "<li>Disbanding a team is permanent, make sure you know what you're doing!";
echo "</ul>";

View File

@ -3,68 +3,70 @@
require_once("util.inc");
require_once("team.inc");
require_once("db.inc");
require_once("login.inc");
db_init();
$user = get_user_from_cookie();
if (!strlen($HTTP_POST_VARS["name"])) {
page_head("Error");
echo "You must specify a name for your team.";
if (!$user) {
print_login_form();
} else {
$query = sprintf(
"insert into team (userid, name, name_lc, url, type, name_html, description, nusers) values(%d, '%s', '%s', '%s', %d, '%s', '%s', %d)",
$user->id,
$HTTP_POST_VARS["name"],
strtolower($HTTP_POST_VARS["name"]),
$HTTP_POST_VARS["url"],
$HTTP_POST_VARS["type"],
$HTTP_POST_VARS["name_html"],
$HTTP_POST_VARS["description"],
1
);
$result = mysql_query($query);
if ($result) {
$query_team = sprintf(
"select * from team where userid = %d and name = '%s'",
$user->id,
$HTTP_POST_VARS["name"]
);
$result_team = mysql_query($query_team);
$team = mysql_fetch_object($result_team);
if ($user->teamid != 0) {
$query_team_other = sprintf(
"select * from team where id = %d",
$user->teamid
);
$result_team_other = mysql_query($query_team_other);
$first_team = mysql_fetch_object($result_team_other);
$first_nusers = $first_team->nusers;
$first_new_nusers = $first_nusers - 1;
$query_team_table_other = sprintf(
"update team set nusers = %d where id = %d",
$first_new_nusers,
$first_team->id
);
$result_team_table_other = mysql_query($query_team_table_other);
}
$query_user_table = sprintf(
"update user set teamid = %d where id = %d",
$team->id,
$user->id
);
$result_user_table = mysql_query($query_user_table);
}
if ($result && $result_user_table) {
display_team_page($team);
} else {
if (!strlen($HTTP_POST_VARS["name"])) {
page_head("Error");
echo "Couldn't create team - please try later.<br>\n";
echo "You may need to try a different team name.\n";
echo "You must specify a name for your team.";
} else {
$query = sprintf(
"insert into team (userid, name, name_lc, url, type, name_html, description, nusers) values(%d, '%s', '%s', '%s', %d, '%s', '%s', %d)",
$user->id,
$HTTP_POST_VARS["name"],
strtolower($HTTP_POST_VARS["name"]),
$HTTP_POST_VARS["url"],
$HTTP_POST_VARS["type"],
$HTTP_POST_VARS["name_html"],
$HTTP_POST_VARS["description"],
1
);
$result = mysql_query($query);
if ($result) {
$query_team = sprintf(
"select * from team where userid = %d and name = '%s'",
$user->id,
$HTTP_POST_VARS["name"]
);
$result_team = mysql_query($query_team);
$team = mysql_fetch_object($result_team);
if ($user->teamid != 0) {
$query_team_other = sprintf(
"select * from team where id = %d",
$user->teamid
);
$result_team_other = mysql_query($query_team_other);
$first_team = mysql_fetch_object($result_team_other);
$first_nusers = $first_team->nusers;
$first_new_nusers = $first_nusers - 1;
$query_team_table_other = sprintf(
"update team set nusers = %d where id = %d",
$first_new_nusers,
$first_team->id
);
$result_team_table_other = mysql_query($query_team_table_other);
}
$query_user_table = sprintf(
"update user set teamid = %d where id = %d",
$team->id,
$user->id
);
$result_user_table = mysql_query($query_user_table);
}
if ($result && $result_user_table) {
display_team_page($team);
} else {
page_head("Error");
echo "Couldn't create team - please try later.<br>\n";
echo "You may need to try a different team name.\n";
}
}
}
page_tail();
page_tail();
}
?>

View File

@ -32,7 +32,7 @@
$team_name = $team->name;
page_head("$team_name disbanded");
echo "<h2>Disband Complete</h2>";
echo "You have disbanded $team_name";
echo "You have disbanded $team_name.";
} else {
page_head("Error");
echo "Couldn't disband team - please try later.\n";

View File

@ -24,8 +24,8 @@ if (!$team) {
page_head("Permission denied");
echo "Only a team's founder may view a team's email list.";
} else {
page_head("Team Email List");
echo "<h2>Team Email List</h2>";
page_head("$team->name Email List");
echo "<h2>Email List for $team->name</h2>";
echo "<table border=1><tr><th>Name</th>";
echo "<th>Email Address</th></tr>";
$query = sprintf(

View File

@ -10,7 +10,7 @@
$words = preg_split("/[\s,]+/", $team_name);
$length = count($words);
$name_lc = strtolower($team_name);
$query = sprintf(
"select * from team where name_lc like '%s'",
"%$name_lc%"
@ -20,6 +20,8 @@
if ($result_list) {
$total = 0;
echo "<h2>Search results for '$team_name'</h2>";
echo "<p>";
echo "You may view these teams' members, statistics, and information.";
echo "<ul>";
while ($team_possible = mysql_fetch_object($result_list)) {
if ($total >= 100) {

View File

@ -6,7 +6,7 @@
db_init();
$user = get_user_from_cookie();
$query = sprintf(
"select * from team where id = %d",
$HTTP_POST_VARS["id"]
@ -40,7 +40,7 @@
}
} else {
page_head("Unable to remove $user->name");
echo "$user->name is not a member of this $team_name.\n";
echo "$user->name is not a member of $team_name.\n";
}
page_tail();

View File

@ -5,7 +5,7 @@
db_init();
$user = get_user_from_cookie();
if ($user) {
show_user_page($user, $project);
show_user_page($user);
} else {
echo "Not logged in";
}

View File

@ -11,14 +11,21 @@ function show_hosts($user) {
mysql_free_result($result);
}
function show_user_page($user, $project) {
echo "<h1>Welcome, $user->name!</h1>\n";
function show_user_page($user) {
echo "<h1>Welcome $user->name</h1>\n";
start_table();
show_user_profile($user);
echo "<p><p>\n";
show_user_stats($user, $project);
row("Total credit", $user->total_credit);
if ($user->teamid) {
$result = mysql_query("select * from team where id = $user->teamid");
$team = mysql_fetch_object($result);
row("Team", "<a href=team_display.php?id=$team->id>$team->name</a>");
} else {
row("Team", "none");
}
echo "</table>";
echo "<p>\n";
echo "<ul>";
echo "<li><a href=show_user.php>Complete user info</a></li>";
echo "<li><a href=show_hosts.php>Host info</a></li>";
echo "<li><a href=prefs.php>Preferences</a></li>";
echo "<li><a href=team.php>Teams</a></li>";

View File

@ -2,17 +2,12 @@
require_once("db.inc");
define("LG_FONT", "<font size=+1>");
define("SM_FONT", "<font size=-1>");
define("TD2", "<td colspan=2 bgcolor=#708090>");
define("TD3", "<td colspan=3 bgcolor=#708090>");
define("TABLE", "<table cellpadding=10 cellspacing=4 border=0 width=100%>");
define("TABLE2", "<table width=580>");
define("BG_COLOR", " bgcolor=cccccc ");
define("TITLE_COLOR", " bgcolor=000000 ");
define("TITLE_FONT", " <font color=ffffff> ");
define("BODY_COLOR", " bgcolor=ffffff ");
define("PROJECT_NAME", "BOINC");
define("PROJECT_NAME", "SAMPLE PROJECT");
function get_user_from_cookie() {
$auth = "";
@ -35,12 +30,11 @@ 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.html>".PROJECT_NAME.":</a> $title</b></font></td></tr></table>\n";
echo TABLE . "<tr " . TITLE_COLOR . "><td>" . TITLE_FONT . "<font size=6><b><a href=index.php>".PROJECT_NAME.":</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";
printf("<hr><a href=home.php>Home</a>\n");
}
function date_str($when) {
@ -60,14 +54,6 @@ function row($x, $y) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td></tr>\n";
}
function row2($x, $y) {
echo "<tr><td>$x</td><td>$y</td></tr>\n";
}
function row3($x, $y, $z) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td><td>$x</td></tr>\n";
}
function random_string() {
return md5(uniqid(rand()));
}