2002-04-30 22:22:54 +00:00
< ? php
require_once ( " db.inc " );
2002-08-13 00:08:08 +00:00
define ( " EMAIL_EXISTS " , - 1 );
define ( " EMAIL_UPDATED " , 1 );
define ( " EMAIL_FAIL " , - 2 );
2002-08-12 22:16:34 +00:00
define ( " LG_FONT " , " <font size=+1> " );
define ( " SM_FONT " , " <font size=-1> " );
2002-08-13 00:08:08 +00:00
2002-08-13 23:59:34 +00:00
define ( " TD " , " <td bgcolor=#708090> " );
2002-08-12 22:16:34 +00:00
define ( " TD2 " , " <td colspan=2 bgcolor=#708090> " );
define ( " TD3 " , " <td colspan=3 bgcolor=#708090> " );
2002-08-13 00:08:08 +00:00
2002-04-30 22:22:54 +00:00
define ( " TABLE " , " <table cellpadding=10 cellspacing=4 border=0 width=100%> " );
2002-08-12 22:16:34 +00:00
define ( " TABLE2 " , " <table width=580> " );
2002-08-13 00:08:08 +00:00
2002-04-30 22:22:54 +00:00
define ( " BG_COLOR " , " bgcolor=cccccc " );
define ( " TITLE_COLOR " , " bgcolor=000000 " );
2002-08-05 23:20:57 +00:00
define ( " TITLE_FONT " , " <font color=ffffff> " );
2002-04-30 22:22:54 +00:00
define ( " BODY_COLOR " , " bgcolor=ffffff " );
2002-08-13 23:59:34 +00:00
define ( " NOLOGIN " , " Not logged in. Click <a href=login.php>here</a> to login. \n " );
define ( " BADPASS " , " The password you entered is incorrect. Click the <b>Back</b> button on your browser to re-enter your password or try again later. " );
define ( " DIFFPASS " , " You've typed two different passwords. Click the <b>Back</b> 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 ;
}
2002-04-30 22:22:54 +00:00
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 ) {
2002-08-07 18:56:55 +00:00
if ( $user ) {
printf ( " Logged in as %s. \n " , $user -> name );
printf ( " <br><a href=login.php>Log in as someone else.</a> \n " );
2002-08-13 23:59:34 +00:00
$project = get_project_name ();
printf ( " <br><a href=this_user.php>My %s</a> \n " , $project );
2002-08-07 18:56:55 +00:00
} else {
2002-08-13 00:08:08 +00:00
echo NOLOGIN ;
2002-08-07 18:56:55 +00:00
}
2002-04-30 22:22:54 +00:00
}
function page_head ( $title ) {
echo " <head><title> $title </title><body " . BG_COLOR . " > \n " ;
2002-08-13 23:59:34 +00:00
$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 " ;
2002-04-30 22:22:54 +00:00
}
function page_tail () {
2002-08-12 22:16:34 +00:00
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 " ;
2002-08-13 23:59:34 +00:00
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-04-30 22:22:54 +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 () {
echo " <table width=600 border=2 cellpadding=4> " ;
}
function row ( $x , $y ) {
echo " <tr><td width=30% valign=top align=right> $x </td><td> $y </td></tr> \n " ;
}
2002-08-12 22:16:34 +00:00
function row2 ( $x , $y ) {
echo " <tr><td> $x </td><td> $y </td></tr> \n " ;
}
function row3 ( $x , $y , $z ) {
2002-08-12 23:31:43 +00:00
echo " <tr><td width=30% valign=top align=right> $x </td><td> $y </td><td> $z </td></tr> \n " ;
2002-08-12 22:16:34 +00:00
}
2002-04-30 22:22:54 +00:00
function random_string () {
return md5 ( uniqid ( rand ()));
}
function print_country_select () {
2002-08-08 20:49:09 +00:00
PassThru ( " /disks/milkyway/a/users/anderson/boinc/tools/country_select " );
2002-04-30 22:22:54 +00:00
}
2002-08-05 23:20:57 +00:00
function print_page_header ( $title ) {
echo " <html> \n " ;
echo " <head> \n " ;
echo " <title> $title </title> \n " ;
echo " </head> \n " ;
echo " <body BGCOLOR=000000 TEXT=FFFFFF LINK=cc99ff VLINK=cc99ff> \n " ;
echo " <br clear=all><br> \n " ;
}
function print_page_end () {
echo " </body></html> " ;
}
2002-08-13 00:08:08 +00:00
?>