Exemplo n.º 1
0
function show_user_wap($user)
{
    wap_begin();
    if (!$user) {
        echo "<br/>User not found!<br/>";
        wap_end();
        return;
    }
    // keep a 'running tab' in wapstr in case exceeds 1K WAP limit
    $wapstr = PROJECT . "<br/>Account Data<br/>for {$user->name}<br/>Time: " . wap_timestamp();
    $wapstr .= show_credit_wap($user);
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
        $wapstr .= "<br/>Team: {$team->name}<br/>";
        $wapstr .= "Team TotCred: " . format_credit($team->total_credit) . "<br/>";
        $wapstr .= "Team AvgCred: " . format_credit($team->expavg_credit) . "<br/>";
    } else {
        $wapstr .= "<br/>Team: None<br/>";
    }
    // don't want to send more than 1KB probably?
    if (strlen($wapstr) > 1024) {
        echo substr($wapstr, 0, 1024);
    } else {
        echo $wapstr;
    }
    wap_end();
}
Exemplo n.º 2
0
function show_user_wap($userid)
{
    wap_begin();
    $user = BoincUser::lookup_id($userid);
    if (!$user) {
        echo "<br/>" . tra("User not found!") . "<br/>";
        wap_end();
        return;
    }
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
    }
    $wapstr = PROJECT . "<br/>" . tra("Account Data<br/>for %1<br/>Time:", $user->name) . " " . wap_timestamp();
    $wapstr .= show_credit_wap($user);
    if ($user->teamid && $team) {
        $wapstr .= "<br/>" . tra("Team:") . " " . $team->name . "<br/>";
        $wapstr .= tra("Team TotCred:") . " " . format_credit($team->total_credit) . "<br/>";
        $wapstr .= tra("Team AvgCred:") . " " . format_credit($team->expavg_credit) . "<br/>";
    } else {
        $wapstr .= "<br/>" . tra("Team: None") . "<br/>";
    }
    // don't want to send more than 1KB (WAP limit)
    //
    if (strlen($wapstr) > 1024) {
        $wapstr = substr($wapstr, 0, 1024);
    }
    echo $wapstr;
    wap_end();
}
Exemplo n.º 3
0
    mysql_free_result($result);
    return $cnt[0];
}
require_once "../inc/util.inc";
require_once "../inc/db.inc";
//require_once("../inc/trickle.inc");
require_once "../inc/wap.inc";
// show the home page of app user from envvar
$valid = $_GET['id'];
if (!$valid || $valid != "whatever-validation-key-you-want") {
    echo "User id (t.php?id=###) missing!";
    exit;
    // can't do much without a userid!
}
db_init();
wap_begin();
// keep a 'running tab' in wapstr in case exceeds 1K WAP limit
$wapstr = PROJECT . "<br/>Status Info on<br/>" . wap_timestamp() . "<br/><br/>";
$wapstr .= "#Users: " . getSingleQuery("select count(*) from user") . "<br/>";
$wapstr .= "#Hosts: " . getSingleQuery("select count(*) from host") . "<br/>";
$wapstr .= "#ModYr: " . sprintf("%ld", getSingleQuery("select sum(total_credit)/(.007*17280.0) from host")) . "<br/>";
$wapstr .= "#Cobbl: " . sprintf("%ld", getSingleQuery("select sum(total_credit) from host")) . "<br/>";
// I consider a host active if it's trickled in the last week
//$wapstr .= "#Activ: " . getSingleQuery("select count(distinct hostid) from cpdnexpt.trickle "
//   . "where trickledate>=" . sprintf("%d", mktime() - (3600*24*7))) . "<br/>";
// finally get last 5 trickles for everyone
//$wapstr .= show_trickles("a", 0, 5, 1);
// limit wap output to 1KB
if (strlen($wapstr) > 1024) {
    echo substr($wapstr, 0, 1024);
} else {