예제 #1
0
function getPlayerClass($playerName)
{
    $pid = getPid($playerName);
    if ($pid == 0) {
        return 0;
    }
    $tournRank = 1;
    $strictRank = 1;
    $query = "SELECT u.username, u.user_onirc, u.user_email, u.user_game_type, u.user_blurb, u.user_viewblurb, u.user_viewemail, s.open_num_games, s.open_num_bases, s.open_num_pills, s.open_num_tanks, s.tourn_num_games, s.tourn_score, s.tourn_wins, s.tourn_loses, s.tourn_num_bases, s.tourn_num_pills, s.tourn_num_tanks, s.strict_num_games, s.strict_wins, s.strict_loses, s.strict_num_bases, s.strict_num_pills, s.strict_num_tanks, s.strict_score, u.user_regdate, u.user_icq, u.user_aim, u.user_website, u.user_occ, u.user_from, u.user_yim, u.user_msnm, u.user_sig, u.user_emailforward, u.user_showforward from stats_player s, users u where s.pid = u.user_id and u.user_id = " . $pid;
    $result = mysql_query($query);
    $pc = new PlayerInfoClass();
    $pc->setStuff($pid, mysql_result($result, 0, "username"), mysql_result($result, 0, "user_email"), mysql_result($result, 0, "user_game_type"), mysql_result($result, 0, "user_blurb"), mysql_result($result, 0, "user_viewblurb"), mysql_result($result, 0, "user_viewemail"), mysql_result($result, 0, "open_num_games"), mysql_result($result, 0, "open_num_pills"), mysql_result($result, 0, "open_num_bases"), mysql_result($result, 0, "open_num_tanks"), mysql_result($result, 0, "tourn_num_games"), mysql_result($result, 0, "tourn_wins"), mysql_result($result, 0, "tourn_loses"), mysql_result($result, 0, "tourn_score"), mysql_result($result, 0, "tourn_num_pills"), mysql_result($result, 0, "tourn_num_bases"), mysql_result($result, 0, "tourn_num_tanks"), $tournRank, mysql_result($result, 0, "strict_num_games"), mysql_result($result, 0, "strict_score"), mysql_result($result, 0, "strict_wins"), mysql_result($result, 0, "strict_loses"), mysql_result($result, 0, "strict_num_pills"), mysql_result($result, 0, "strict_num_bases"), mysql_result($result, 0, "strict_num_tanks"), $strictRank, mysql_result($result, 0, "user_icq"), mysql_result($result, 0, "user_aim"), mysql_result($result, 0, "user_yim"), mysql_result($result, 0, "user_website"), mysql_result($result, 0, "user_occ"), mysql_result($result, 0, "user_msnm"), mysql_result($result, 0, "user_regdate"), mysql_result($result, 0, "user_sig"), mcHasTopLevelCollection($pid), mysql_result($result, 0, "user_emailforward"), mysql_result($result, 0, "user_showforward"));
    $pc->setOnIrc(mysql_result($result, 0, "user_onirc"));
    // Get number of posts
    $query = "SELECT count(*) AS total FROM posts where poster_id = " . $pid;
    $result = mysql_query($query);
    $pc->setNumPosts(mysql_result($result, 0, "total"));
    if ($pc->getNumPosts() > 0) {
        // Get Posting statistics
        $result = mysql_query("SELECT count(*) AS total FROM posts");
        $pc->setPercentPosts($pc->getNumPosts() / mysql_result($result, 0, "total") * 100);
        if ((time() - strtotime($pc->getRegisteredDate())) / (24 * 60 * 60) < 1) {
            $pc->setPostsPerDay($pc->getNumPosts());
        } else {
            $pc->setPostsPerDay($pc->getNumPosts() / ((time() - strtotime($pc->getRegisteredDate())) / (24 * 60 * 60)));
        }
        mysql_free_result($result);
    }
    $teams = array();
    $query = "select t.name from stats_team t, team_members m where t.tid = m.tid and m.pid = '{$pid}' order by t.name";
    $result = mysql_query($query);
    $count = 0;
    while ($count < mysql_numrows($result)) {
        $teams[$count] = mysql_result($result, $count, "name");
        $count++;
    }
    $pc->setTeams($teams);
    // Get ranks
    $pc->setTournRank(getRank("stats_player", "tourn_score", $pc->getTournScore(), $pid, "pid", "tourn"));
    $pc->setStrictRank(getRank("stats_player", "strict_score", $pc->getStrictScore(), $pid, "pid", "strict"));
    $pc->setPageViews(getPageViews("view_player", $pid));
    # Get Active Games
    $activeGames = array();
    $activeSql = "SELECT g.gs_ip, g.gs_port, g.gs_key from game_server g, active_player p where p.ap_left = 0 and p.ap_pid = '{$pid}' and g.gs_key = p.ap_serverkey";
    $activeResult = mysql_query($activeSql);
    $count = 0;
    while ($count < mysql_numrows($activeResult)) {
        $activeGames[$count] = mysql_result($activeResult, $count, "gs_ip");
        $activeGames[$count + 1] = mysql_result($activeResult, $count, "gs_port");
        $activeGames[$count + 2] = mysql_result($activeResult, $count, "gs_key");
        $count += 3;
    }
    $pc->setActiveGames($activeGames);
    return $pc;
}
예제 #2
0
     $dataF = $_REQUEST['data_a'];
     $datainizio = substr($_REQUEST['data_da'], 0, 10);
     $rsl = explode('/', $datainizio);
     $rsl = array_reverse($rsl);
     $datainizio = implode($rsl, '-');
     $statsStartDate = $datainizio;
     $datafine = substr($_REQUEST['data_a'], 0, 10);
     $rsl = explode('/', $datafine);
     $rsl = array_reverse($rsl);
     $datafine = implode($rsl, '-');
     $statsEndDate = $datafine;
     $analytics = getService();
     $profile = getFirstProfileId($analytics);
     $sessioni = getSessions($analytics, $profile, $statsStartDate, $statsEndDate);
     $utenti = getUsers($analytics, $profile, $statsStartDate, $statsEndDate);
     $visualizzazioni = getPageViews($analytics, $profile, $statsStartDate, $statsEndDate);
     $pagsess = getPageViewsSessions($analytics, $profile, $statsStartDate, $statsEndDate);
     $duratasessmedia = getAvgSessionDuration($analytics, $profile, $statsStartDate, $statsEndDate);
     $bounce = getBounceRate($analytics, $profile, $statsStartDate, $statsEndDate);
     $nuovesess = getPercentNewSessions($analytics, $profile, $statsStartDate, $statsEndDate);
 } else {
     $Date = date("Y-m-d");
     $dataF = date('Y-m-d', strtotime($Date . ' - 1 days'));
     $dataI = date('Y-m-d', strtotime($dataF . ' - 1 months'));
     $dataI = substr($dataI, 0, 10);
     $rsl = explode('-', $dataI);
     $rsl = array_reverse($rsl);
     $dataI = implode($rsl, '/');
     $dataF = substr($dataF, 0, 10);
     $rsl = explode('-', $dataF);
     $rsl = array_reverse($rsl);