2002-08-26 22:57:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("db.inc");
|
|
|
|
|
|
|
|
define("EMAIL_EXISTS", -1);
|
|
|
|
define("EMAIL_UPDATED", 1);
|
|
|
|
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>");
|
|
|
|
|
|
|
|
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("NOLOGIN", "Not logged in. Click <a href=login.php>here</a> to login.\n");
|
|
|
|
|
|
|
|
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 = "";
|
|
|
|
$c = getenv("HTTP_COOKIE");
|
|
|
|
$d = str_replace("; ", "&", $c);
|
|
|
|
parse_str($d);
|
|
|
|
if ($auth) return lookup_user_auth($auth);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
|
|
|
$project = get_project_name();
|
|
|
|
printf("<br><a href=this_user.php>My %s</a>\n", $project);
|
|
|
|
} else {
|
|
|
|
echo NOLOGIN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function page_head($title) {
|
|
|
|
echo "<head><title>$title</title><body " . BG_COLOR . ">\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.php> Main Project Page </a>|</td></tr></table>\n";
|
|
|
|
}
|
|
|
|
|
2002-08-30 21:07:50 +00:00
|
|
|
function print_form_header($table) {
|
|
|
|
echo "<form method=get action=db.php>\n";
|
|
|
|
echo "<p>\n";
|
|
|
|
echo "<input type=hidden name=show value=$table>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_form_end() {
|
|
|
|
echo "<p>\n";
|
|
|
|
echo "<input type=submit name=\"new_query\" value=\"Query\">\n";
|
|
|
|
echo "<input type=submit name=\"show_more\" value=\"Show More\">\n";
|
|
|
|
echo "</form>\n";
|
|
|
|
}
|
|
|
|
|
2002-08-28 20:51:17 +00:00
|
|
|
function append_sql_query($original,$addition,$first) {
|
|
|
|
if ($first == 1) {
|
|
|
|
return $original . " where " . $addition;
|
|
|
|
} else {
|
|
|
|
return $original . " and " . $addition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-26 22:57:17 +00:00
|
|
|
function date_str($when) {
|
|
|
|
return date("g:i A, l M j", $when);
|
|
|
|
}
|
|
|
|
|
|
|
|
function time_str($x) {
|
|
|
|
if ($x == 0) return "---";
|
|
|
|
return strftime("%T %b %e, %Y", $x);
|
|
|
|
}
|
|
|
|
|
|
|
|
function start_table() {
|
2002-08-28 20:51:17 +00:00
|
|
|
echo "<table border=2 cellpadding=4 width=700>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function end_table() {
|
|
|
|
echo "</table>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_checkbox($text,$name,$checked) {
|
|
|
|
echo "<input type=checkbox name=$name"
|
|
|
|
. (strlen($checked) ? " checked" : "") . ">"
|
|
|
|
. "$text\n"
|
|
|
|
. "<p>\n";
|
|
|
|
}
|
|
|
|
|
2002-10-18 19:25:30 +00:00
|
|
|
function print_radio_button($text,$name,$value,$checked) {
|
|
|
|
echo "<input type=radio name=$name value=$value"
|
|
|
|
. (strlen($checked) ? " checked" : "") . ">"
|
|
|
|
. "$text\n"
|
|
|
|
. "<br>\n";
|
|
|
|
}
|
|
|
|
|
2002-08-30 21:07:50 +00:00
|
|
|
function print_text_field($text,$name,$value) {
|
2002-10-20 22:12:53 +00:00
|
|
|
echo "$text <input type=text size=10 name=$name value=\"$value\">\n<p>\n";
|
2002-08-26 22:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function row($x, $y) {
|
2002-10-22 01:26:21 +00:00
|
|
|
echo "<tr>\n<td valign=top align=right>$x</td>\n<td>$y</td>\n</tr>\n";
|
2002-08-26 22:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function print_page_header($title) {
|
|
|
|
echo "<html>\n";
|
|
|
|
echo "<head>\n";
|
|
|
|
echo "<title>$title</title>\n";
|
|
|
|
echo "</head>\n";
|
2002-08-28 20:51:17 +00:00
|
|
|
echo "<body TEXT=000000 BGCOLOR=FFFFFF>\n";
|
|
|
|
echo "<h2>$title</h2>\n";
|
2002-10-20 22:12:53 +00:00
|
|
|
echo "<a href=index.html>Return to main page</a>\n";
|
2002-08-28 20:51:17 +00:00
|
|
|
echo "<br clear=all>\n";
|
2002-08-26 22:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function print_page_end() {
|
|
|
|
echo "</body></html>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|