function printStats($titles)
{
    $columns = array('counter', 'revisions', 'links', 'age');
    $stats = array();
    foreach ($titles as $t) {
        if (!$t) {
            continue;
        }
        $stats[] = getStats($t);
    }
    foreach ($columns as $c) {
        echo "{$c}:\t";
        if (strlen($c) < 6) {
            echo "\t";
        }
        $sum = 0;
        foreach ($stats as $x) {
            $sum += $x[$c];
        }
        if (sizeof($stats) == 0) {
            echo "-\n";
        } else {
            echo number_format($sum / sizeof($stats), 2) . "\n";
        }
    }
    echo "\n\n";
}
Esempio n. 2
0
function presentUser($user)
{
    echo '<div class="' . (empty($user['shaddow']) ? 'clean' : 'shaddow') . '" style="border: 1px solid #eee; margin: 1em; padding: .5em">';
    echo '<input style="float: right" type="submit" onclick="setUserid(this, \'' . $user['userid'] . '\', \'useridTo\')" value="Map to this" />';
    echo '<input style="float: right" type="submit" onclick="setUserid(this, \'' . $user['userid'] . '\', \'useridFrom\')" value="Map from this" />';
    echo '<h3 style="color: green">' . $user['username'] . '</h3>';
    echo '<dl>
	
		<dt>UserID</dt>
			<dd><tt>' . $user['userid'] . '</tt></dd>

		<dt>realm</dt>
			<dd><tt>' . $user['realm'] . '</tt></dd>

		<dt>email</dt>
			<dd>' . $user['email'] . '</dd>

		<dt>org</dt>
			<dd>' . $user['org'] . '</dd>

		<dt>orgunit</dt>
			<dd>' . $user['orgunit'] . '</dd>

		<dt>idp</dt>
			<dd><tt>' . $user['idp'] . '</tt></dd>

		<dt>shaddow</dt>
			<dd>' . $user['shaddow'] . '</dd>
			
		<dt>Stats</dt>
			<dd>' . getStats($user['stats']) . '</dd>
			
		</dl>';
    echo '</div>';
}
Esempio n. 3
0
function printTotal()
{
    $votes = getStats();
    $total = 0;
    foreach ($votes as $key => $value) {
        $total += $value;
    }
    $totalMoney = $total / 1000 * 1.56 * 3;
    echo "~ \$" . number_format($totalMoney, 2);
}
Esempio n. 4
0
function presentUser($user, $realmTo)
{
    $to = '';
    if (preg_match('/^(.*?)@/', $user['userid'], $matches)) {
        $to = $matches[1] . '@' . $realmTo;
    }
    echo '<div class="' . (empty($user['shaddow']) ? 'clean' : 'shaddow') . '" style="border: 1px solid #eee; margin: 1em; padding: .5em">';
    echo '<input style="float: right" type="submit" onclick="setUserid(this, \'' . $user['userid'] . '\', \'' . $to . '\')" value="Map this user" />';
    echo '<h3 style="color: green">' . $user['username'] . '</h3>';
    echo '<dl>
	
		<dt>UserID</dt>
			<dd><tt>' . $user['userid'] . '</tt></dd>

		<dt>realm</dt>
			<dd><tt>' . $user['realm'] . '</tt></dd>

		<dt>email</dt>
			<dd>' . $user['email'] . '</dd>

		<dt>org</dt>
			<dd>' . $user['org'] . '</dd>

		<dt>orgunit</dt>
			<dd>' . $user['orgunit'] . '</dd>

		<dt>idp</dt>
			<dd><tt>' . $user['idp'] . '</tt></dd>

		<dt>shaddow</dt>
			<dd>' . $user['shaddow'] . '</dd>
			
		<dt>Stats</dt>
			<dd>' . getStats($user['stats']) . '</dd>
			
		</dl>';
    echo '</div>';
}
Esempio n. 5
0
/**
 * Function generate file with all stats for one region
 */
function generateStats()
{
    global $bdd, $region;
    $stats = array();
    /*** GLOBAL INFO ***/
    $statement = $bdd->prepare('SELECT count(*) FROM `match`
                                        WHERE region = "' . $region . '"');
    $statement->execute();
    $data = $statement->fetchAll()[0][0];
    $stats["info"]["number"] = $data;
    /*** CHAMPION INFO ***/
    $statement = $bdd->prepare('SELECT * FROM champion');
    $statement->execute();
    $data = $statement->fetchAll();
    $numberOfChampions = count($data);
    for ($i = 0; $i < $numberOfChampions; $i++) {
        $champion = $data[$i];
        $stats["champions"][$i] = ["id" => $champion["id"], "stats" => array()];
    }
    getNumberOfGamesPlayed($stats["champions"]);
    getNumberOfGamesBanned($stats["champions"]);
    getNumberOfGamesWon($stats["champions"]);
    getStats($stats["champions"]);
    /*** BLACK MARKET INFO ***/
    $stats["bwmerc"] = array();
    getKrakensSpent($stats["bwmerc"]);
    getBrawlersStats($stats["bwmerc"]);
    getBestCompositionOfBrawlers($stats["bwmerc"]);
    /*** ITEMS INFO ***/
    $stats["items"] = array();
    getItemsStats($stats["items"]);
    echo '<pre>';
    print_r($stats);
    $fp = fopen($region . '.json', 'w');
    fwrite($fp, json_encode($stats));
    fclose($fp);
}
 if ($argv[0] == "update") {
     //This is used to update the table from the last date
     //data was entered until now
     echo "\n\nSTARTING UPDATE\n\n";
     $startDate = getLastDate($dbr);
     if ($argv[1] != null && preg_match('@[^0-9]@', $endDate) == 0) {
         $now = $argv[1] . "000000";
     } else {
         $now = wfTimestamp(TS_MW, time());
     }
     //Grab the old stats so we can compare
     $oldStats = getStats($dbr);
     //update the new stats
     updateStats($dbw, $dbr, $startDate, $now);
     //Grab the new stats
     $newStats = getStats($dbr);
     $editedStats = array();
     $createdStats = array();
     $nabStats = array();
     $patrolStats = array();
     //Compare the stats and output
     foreach ($newStats as $userId => $data) {
         if ($oldStats[$userId] == null) {
             $oldStats[$userId] = array();
             $oldStats[$userId]['edited'] = 0;
             $oldStats[$userId]['created'] = 0;
             $oldStats[$userId]['nab'] = 0;
             $oldStats[$userId]['patrol'] = 0;
         }
         //first check edited
         foreach ($editLevels as $level) {
Esempio n. 7
0
/***************************************
 * http://www.program-o.com
 * PROGRAM O
 * Version: 2.4.7
 * FILE: stats.php
 * AUTHOR: Elizabeth Perreau and Dave Morton
 * DATE: 12-12-2014
 * DETAILS: Displays chatbot statistics for the currently selected chatbot
 ***************************************/
$oneday = getStats("today");
$oneweek = getStats("-1 week");
$onemonth = getStats("-1 month");
$sixmonths = getStats("-6 month");
$oneyear = getStats("1 year ago");
$alltime = getStats("all");
$singlelines = getChatLines(1, 1);
$alines = getChatLines(1, 25);
$blines = getChatLines(26, 50);
$clines = getChatLines(51, 100);
$dlines = getChatLines(101, 1000000);
$avg = getChatLines("average", 1000000);
$upperScripts = '';
$topNav = $template->getSection('TopNav');
$leftNav = $template->getSection('LeftNav');
$main = $template->getSection('Main');
$navHeader = $template->getSection('NavHeader');
$FooterInfo = getFooter();
$errMsgClass = !empty($msg) ? "ShowError" : "HideError";
$errMsgStyle = $template->getSection($errMsgClass);
$noLeftNav = '';
Esempio n. 8
0
function printFunction()
{
    $stats = getStats();
    $totalWidth = 300 - 16;
    ?>
		<div class="line-owned">
			<div class="box-icone"><i class="fa fa-check"></i></div>
			<div class="box-bar">
				<div class="box-number-result">
					<span class="result-text"><?php 
    echo number_format($stats['ownArchi'] * 100 / $stats['totalArchi'], 0) . '%';
    ?>
</span>
				</div>
				<div class="empty-bar">
					<div
						class="percentage-bar"
						style="width: <?php 
    echo definedWidth($stats['totalArchi'], $stats['ownArchi'], $totalWidth) . 'px';
    ?>
">
					</div>
				</div>
			</div>
			<div class="box-info">
				<div class="box-number-info">
					<?php 
    echo $stats['ownArchi'] . ' / ' . $stats['totalArchi'];
    ?>
				</div>
			</div>
		</div>
		<div class="line-catchable">
			<div class="box-icone"><i class="fa fa-crosshairs"></i></div>
			<div class="box-bar">
				<div class="box-number-result">
					<span class="result-text"><?php 
    echo $stats['catchArchi'];
    ?>
</span>
				</div>
				<div class="empty-bar">
					<div
						class="percentage-bar"
						style="width: <?php 
    echo definedWidth($stats['totalArchi'], $stats['catchArchi'], $totalWidth) . 'px';
    ?>
">
					</div>
				</div>
			</div>
			<div class="box-info">
				<div class="box-number-info">
					<?php 
    echo number_format($stats['priceCatchArchi'], 0, ',', ' ') . 'K';
    ?>
				</div>
				<?php 
    if ($stats['catchNotPrice'] != 0) {
        ?>
<div class="box-alert"><i class="fa fa-exclamation"></i></div><?php 
    }
    ?>
			</div>
		</div>
		<div class="line-buy">
			<div class="box-icone box-icone-kamas"></div>
			<div class="box-bar">
				<div class="box-number-result">
					<span class="result-text"><?php 
    echo $stats['buyArchi'];
    ?>
</span>
				</div>
				<div class="empty-bar">
					<div
						class="percentage-bar"
						style="width: <?php 
    echo definedWidth($stats['totalArchi'], $stats['buyArchi'], $totalWidth) . 'px';
    ?>
">
					</div>
				</div>
			</div>
			<div class="box-info">
				<div class="box-number-info">
					<?php 
    echo number_format($stats['priceBuyArchi'], 0, ',', ' ') . 'K';
    ?>
				</div>
				<?php 
    if ($stats['buyNotPrice'] != 0) {
        ?>
<div class="box-alert"><i class="fa fa-exclamation"></i></div><?php 
    }
    ?>
			</div>
		</div>
		<?php 
}
Esempio n. 9
0
function getResults($db, $type)
{
    if ($type == 'all') {
        $sql = "SELECT * FROM " . QUIZDB . " WHERE `locked_quiz` = 0 AND `quiz_end_ts` IS NOT NULL ORDER BY `percentage` DESC";
        return $db->fetch_all_array($sql);
    } elseif ($type == 'my_quiz') {
        $sql = "SELECT * FROM " . QUIZDB . " WHERE  `created_by` = '" . $_SESSION['UA_DETAILS']['randid'] . "' AND `quiz_end_ts` IS NOT NULL ORDER BY `percentage` DESC";
        return $db->fetch_all_array($sql);
    } elseif ($type == 'stats') {
        $stat_arr = getStats($db);
        $stat_arr_max = max($stat_arr);
        $stat_arr_mid = floor($stat_arr_max / 2);
        foreach ($stat_arr as $value) {
            $str2 .= $value . ",";
        }
        $str2 = trim($str2, ",");
        $str = "http://chart.apis.google.com/chart?chxl=0:|0|1-9|10-19|20-29|30-39|40-49|50-59|60-69|70-79|80-89|90-99|100|1:|0|" . $stat_arr_mid . "|" . $stat_arr_max . "|2:|Percentage+Ranges&chxp=2,80&chxt=x,y,x&chbh=31&chs=500x400&cht=bvg&chco=76A4FB&chds=0," . ($stat_arr_max + 10) . "&chd=t:" . $str2 . "&chg=100,10";
        return $str;
    } else {
        $sql = "SELECT * FROM " . QUIZDB . " WHERE  `user` = '" . $_SESSION['UA_DETAILS']['randid'] . "' AND `quiz_end_ts` IS NOT NULL ORDER BY `percentage` DESC";
        return $db->fetch_all_array($sql);
    }
}
Esempio n. 10
0
<?php

require_once "getstats.php";
$_settings = $_SERVER["DOCUMENT_ROOT"] . "/avatars/settings/";
$do = isset($_POST['action']) && $_POST['action'] == 'load' ? 'load' : 'save';
$user = isset($_POST['user']) ? strtolower($_POST['user']) : '';
$set['bColor'] = isset($_POST['bColor']) ? $_POST['bColor'] : '666666';
$set['bgColor'] = isset($_POST['bgColor']) ? $_POST['bgColor'] : '979797';
$set['fontColor'] = isset($_POST['fColor']) ? $_POST['fColor'] : 'cccccc';
$set['smile'] = isset($_POST['smile']) ? $_POST['smile'] : 10;
$set['font'] = isset($_POST['font']) ? $_POST['font'] : 1;
$set['pack'] = isset($_POST['pack']) ? $_POST['pack'] : 1;
$set['showuser'] = isset($_POST['showuser']) && $_POST['showuser'] == 1 ? 1 : 0;
for ($i = 1; $i <= 3; $i++) {
    $set['line' . $i]['title'] = str_replace('&amp;', '&', $_POST['line' . $i]);
    $set['line' . $i]['value'] = $_POST['drp' . $i];
}
if (!empty($user) && $do == 'save') {
    print file_put_contents($_settings . $user . ".set", serialize($set)) ? 1 : 0;
    getStats($user);
} else {
    if (file_exists($_settings . $user . ".set")) {
        print json_encode(unserialize(file_get_contents($_settings . $user . ".set")));
    }
}
Esempio n. 11
0
                        <div class="row">
                            <div class="form-and-links-container col-sm-8 col-sm-offset-2">
                                <div class="countdown-label">
                                    <div id="price">
                                        <p class="text-center"><strong>We Buy</strong> : RM<?php 
getPrice('1', 'we_buy');
?>
/g <i class=<?php 
getStats('1', 'we_buy');
?>
></i></p>
                                        <p class="text-center"><strong>We Sell</strong> : RM<?php 
getPrice('1', 'we_sell');
?>
/g <i class=<?php 
getStats('1', 'we_sell');
?>
></i></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /Countdown -->
                <div class="container">
                    <!-- Description -->
                    <div class="row">
                        <p class="description col-sm-8 col-sm-offset-2">— Last update : <?php 
getTime();
?>
Esempio n. 12
0
                                <div class="clearfix"></div>
                            </div>
                        </a>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-red">
                        <div class="panel-heading special-panel">
                            <div class="row">
                                <div class="row text-center">
                                	<i class="glyphicon glyphicon-piggy-bank dashboard"></i>
                                </div>
                                <div class="col-xs-12 text-center">
                                    <div class="moneysize">
                                        <?php 
getStats("SUM(order_totalprice)", "orders");
?>
                                    </div>
                                    <p>Income</p>
                                </div>
                            </div>
                        </div>
                        <a href="#">
                            <div class="panel-footer">
                                <span class="pull-left">View Details</span>
                                <span class="pull-right"><i class="glyphicon glyphicon-circle-arrow-right"></i></span>
                                <div class="clearfix"></div>
                            </div>
                        </a>
                    </div>
                </div>
Esempio n. 13
0
            ?>
</td>
                      <td nowrap="nowrap" <?php 
            echo "style=\"background-color: {$row_color};\"";
            ?>
><?php 
            echo tarihOku2($row_eoUsers['calismaTarihi']);
            ?>
</td>
                    </tr>
                    <?php 
        } while ($row_eoUsers = mysql_fetch_assoc($eoUsers));
        ?>
                    <tr>
                      <td colspan="6" class="tabloAlt"><?php 
        printf($metin[189], Sec2Time2(round(getStats(9))));
        ?>
</td>
                    </tr>
                  </table>
                  <?php 
        if ($totalRows_eoUsers > $maxRows_eoUsers) {
            ?>
                  <table border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#CCCCCC" >
                    <tr>
                      <td><div align="center"> <a href="<?php 
            printf("%s?pageNum_eoUsers=%d%s&amp;yonU=dur", $currentPage, 0, $queryString_eoUsers);
            ?>
"><img src="img/page-first.gif" border="0" alt="first" /></a> </div></td>
                      <td><div align="center"> <a href="<?php 
            printf("%s?pageNum_eoUsers=%d%s&amp;yonU=dur", $currentPage, max(0, $pageNum_eoUsers - 1), $queryString_eoUsers);
Esempio n. 14
0
              <div>&nbsp;</div>
            </div>
            <div class="Post-cr">
              <div>&nbsp;</div>
            </div>
            <div class="Post-cc"></div>
            <div class="Post-body">
              <div class="Post-inner">
                <div class="PostContent">
                  <div class="tekKolon"> <h3><?php 
    echo $metin[584];
    ?>
 :</h3>
                    <?php 
    echo "<strong><a href='profil.php?kim=" . $uID . "' rel='facebox'><span style='text-transform: capitalize;'>" . strtolower(kullGercekAdi($uID)) . "</span></a></strong><br/>";
    echo getStats(12, $uID);
    ?>
                  </div>
                </div>
                <div class="cleared"></div>
              </div>
            </div>
          </div>
          <?php 
}
?>
          <?php 
$dersID = temizle(isset($_GET["kurs"]) ? $_GET["kurs"] : "");
$uID = temizle(isset($_GET["user"]) ? $_GET["user"] : "");
if (!empty($dersID)) {
    ?>
Esempio n. 15
0
<td id=rightarrow class=arrow></td>
</table>
<div>
<a href="about.php#bigquery">Write your own custom queries!</a>
</div>
</center>

<script type="text/javascript">
// HTML strings for each image
var gaSnippets = new Array();

<?php 
$gLabel = latestLabel();
require_once "stats.inc";
require_once "charts.inc";
$hStats = getStats($gLabel, "All", curDevice());
?>
gaSnippets.push("<?php 
echo bytesContentTypeChart($hStats);
?>
");
gaSnippets.push("<?php 
echo responseSizes($hStats);
?>
");
gaSnippets.push("<?php 
echo percentGoogleLibrariesAPI($hStats);
?>
");
gaSnippets.push("<?php 
echo percentFlash($hStats);
Esempio n. 16
0
$app = new \Slim\App();
// Create Slim app and fetch DI Container
$container = $app->getContainer();
// Register Entity Manager in the container
$container['entityManager'] = function () {
    $conf = parse_ini_file('../conf/conf.db.ini', true);
    $doctrineSettings = ['connection' => ['driver' => $conf['database']['driver'], 'host' => $conf['database']['host'], 'port' => isset($conf['database']['port']) ? $conf['database']['port'] : '3306', 'user' => $conf['database']['user'], 'password' => $conf['database']['password'], 'dbname' => $conf['database']['db'], 'charset' => 'utf8', 'memory' => true], 'annotation_paths' => ['../Entity/Users.php']];
    return EntityManagerBuilder::build($doctrineSettings);
};
$app->add(new \Slim\Middleware\JwtAuthentication(["path" => "/api", "secret" => "supersecretkeyyoushouldnotcommittogithub"]));
$app->get('/', function (Request $request, Response $response) {
    $result = $this->entityManager->createQueryBuilder()->select('user.email, user.password, user.token')->from('Users', 'user')->getQuery()->getArrayResult();
    return json_encode($result);
});
$app->get('/api', function (Request $request, Response $response) {
    getStats($request, $response);
});
$app->get('/login', function (Request $request, Response $response) {
    $result = Firebase\JWT\JWT::encode("ramdont0k3n", "supersecretkeyyoushouldnotcommittogithub");
    $body = $response->getBody();
    $body->write(json_encode($result));
    return $response;
});
$app->run();
function getStats($request, $response)
{
    //$response = $app->response;
    $response->withHeader('Access-Control-Allow-Origin', '*');
    $response->withHeader('Access-Control-Allow-Headers', 'Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With');
    $response->withHeader('Access-Control-Allow-Credentials', 'true');
    $response->withHeader('Cache-Control', 'no-cache');
        if (isOK($response)) {
            printImageArrayResult($response, " ---- GETTING ITEM FAILED ---- ", " ---- GETTING ITEM SUCCESSFULLY COMPLETED ---- ");
        } else {
            echo $response->getMessage();
        }
        break;
    case "getTrackingDatas":
        echo "Getting trackables..." . PHP_EOL;
        $email = getEMail();
        $password = getPassword();
        $dbName = getDbName();
        $response = getTrackingDatas($email, $password, $dbName);
        if (isOK($response)) {
            printImageArrayResult($response, " ---- GETTING TRACKABLES FAILED ---- ", " ---- GETTING TRACKABLES SUCCESSFULLY COMPLETED ---- ", "trackable");
        } else {
            echo $response->getMessage();
        }
        break;
    case "getStats":
        echo "Getting Stats..." . PHP_EOL;
        $email = getEMail();
        $password = getPassword();
        $dbName = getDbName();
        $response = getStats($email, $password, $dbName);
        if (isOK($response)) {
            printResult($response, " ---- GETTING STATS FAILED ---- ", " ---- GETTING STATS SUCCESSFULLY COMPLETED ---- ", true);
        } else {
            echo $response->getMessage();
        }
        break;
}
Esempio n. 18
0
<?php

//When included as part of a drupal module $manifestfile and $resultsfile is set in the module
//When called as a Jquery enpoint dirctly the manifest file should be specified in the query
//In both modes this output is intended to act as a service endpoint called within yesno.js
//The service returns the url of the next image to return by selecting a random line in the manifest
/**
 *TODO 
 *Work out how this will work with non drupal mode - the same issue needs to be address in the save  
 *Work out how to get the id of the current user in drupal
 */
//Handle non drupal request
if ($_GET["resultsfile"] and $_GET["manifestfile"]) {
    getStats($_GET["manifestfile"], $_GET["resultsfile"]);
}
function getStats($manifestfile, $resultsfile)
{
    //At the moment just read the manifest into an array
    //$urls = file($manifestfile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    //Filename will point to the text file but want to read the mfx file
    $folder = pathinfo($manifestfile, PATHINFO_DIRNAME);
    $base = pathinfo($manifestfile, PATHINFO_FILENAME);
    $mfx = "{$folder}/{$base}.mfx";
    $fp = @fopen($mfx, "r");
    //Read the first $headerlength bytes as the header
    $headerlength = 20;
    list($reclen, $totrecs) = explode(":", fread($fp, $headerlength));
    fclose($fp);
    //Open and load the required
    if ($resultsfile) {
        $doc = new DOMDocument();
Esempio n. 19
0
        return $_GET[$getName];
    }
    return $default;
}
function getStats($one, $two)
{
    $safer = ceil(100 / $one * $two);
    $fatalities = ceil(($two - $one) / 3);
    return [$safer - 100, $fatalities];
}
$start = urlencode(getVar("start"));
$end = urlencode(getVar("end"));
$safe = getVar("safest") == "on" ? true : false;
$congestion = getVar("congestion") == "on" ? true : false;
$routes = getSafestRoute($start, $end, $safe, $congestion);
$stats = getStats($routes[0]["points"], $routes[$routes[0]["points"] == $routes[1]["points"] && count($routes) > 2 ? 2 : 1]["points"]);
$safer = $stats[0];
$fatalities = $stats[1];
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	
	<link rel="shortcut icon" href="images/logo.png">
	
	<script>
		var polylines = [<?php 
foreach ($routes[0]["polylines"] as $key => $polyline) {
    echo "\"{$polyline}\"";
Esempio n. 20
0
function homeInfo($user)
{
    $msg = getStats($user);
    $rep = sendsockreply('homepage', $msg);
    if ($rep === false) {
        $ans = false;
    } else {
        $ans = repDecode($rep);
    }
    return $ans;
}
Esempio n. 21
0
        // Get round id
        if (isset($_GET['rid'])) {
            $rid = $_GET['rid'];
        } else {
            $rid = $rounds[0]['id'];
        }
        // Get tables from database
        $timeline = getTable("SELECT id, userid AS `uid`, roundid AS `rid`, score, angle, x FROM timeline WHERE roundid\r\n\t\t\t\tIN (\t\t\t\r\n\t\t\t\t\tSELECT roundid\r\n\t\t\t\t\tFROM timeline\r\n\t\t\t\t\tWHERE roundid=" . $rid . "\r\n\t\t\t\t)");
        $users = getTable("SELECT id, clubid AS `cid`, fname, sname, dob, email, class, auth, datejoined, active FROM users WHERE id IN (SELECT userid FROM timeline WHERE `roundid`='" . $rid . "')");
        for ($i = 0; $i < count($users); $i++) {
            if ($users[$i]['id'] == $uid) {
                $userinfo = $users[$i];
            }
        }
        for ($i = 0; $i < count($rounds); $i++) {
            $roundstats[] = getStats($timeline, $rounds[$i]['id'], $uid);
        }
        $stats = combineStats($roundstats);
        // Remove timeline rows that aren't relevant
        $timeline = filterArray($timeline, "rid", $rid);
        //$userstats = getStats($timeline, -1, $uid);
    }
    ?>
  
	<br>
	<div id="scores">
  
  
  
  
  
Esempio n. 22
0
require_once 'Slim/Slim.php';
require_once 'stats.php';
// Configure
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
/*
 * Get Stats for User ID
 */
$app->get('/stats/:id', function ($id) {
    $stats = getStats($id);
    echo json_encode($stats);
});
/*
 * Get Stats for User ID
 */
$app->post('/stats/:id', function ($id) {
    global $app;
    $stats = getStats($id);
    $key = $app->request->post('result');
    $stats[$key]++;
    saveStats($id, $stats);
    echo json_encode($stats);
});
/*
 * Home
 */
$app->get('/', function () use($app) {
    $app->render('home.html');
});
$app->run();
Esempio n. 23
0
$i = date('i');
if ($i % 15 != 0) {
    exit;
}
$p = array();
$numDays = 7;
$p['limit'] = 10;
$p['pastSeconds'] = $numDays * 86400;
$p['kills'] = true;
Storage::store('Kills5b+', json_encode(Kills::getKills(array('iskValue' => 5000000000), true, false)));
Storage::store('Kills10b+', json_encode(Kills::getKills(array('iskValue' => 10000000000), true, false)));
Storage::store('TopChars', json_encode(Info::doMakeCommon('Top Characters', 'characterID', getStats('characterID'))));
Storage::store('TopCorps', json_encode(Info::doMakeCommon('Top Corporations', 'corporationID', getStats('corporationID'))));
Storage::store('TopAllis', json_encode(Info::doMakeCommon('Top Alliances', 'allianceID', getStats('allianceID'))));
Storage::store('TopShips', json_encode(Info::doMakeCommon('Top Ships', 'shipTypeID', getStats('shipTypeID'))));
Storage::store('TopSystems', json_encode(Info::doMakeCommon('Top Systems', 'solarSystemID', getStats('solarSystemID'))));
Storage::store('TopIsk', json_encode(Stats::getTopIsk(array('pastSeconds' => $numDays * 86400, 'limit' => 5))));
// Cleanup old sessions
Db::execute('delete from zz_users_sessions where validTill < now()');
// Keep the account balance table clean
Db::execute('delete from zz_account_balance where balance = 0');
// Cleanup subdomain stuff
Db::execute('update zz_subdomains set adfreeUntil = null where adfreeUntil < now()');
Db::execute("update zz_subdomains set banner = null where banner = ''");
Db::execute("delete from zz_subdomains where adfreeUntil is null and banner is null and (alias is null or alias = '')");
// Expire change expirations
Db::execute('update zz_users set change_expiration = null, change_hash = null where change_expiration < date_sub(now(), interval 3 day)');
function getStats($column)
{
    $result = Stats::getTop($column, ['isVictim' => false, 'pastSeconds' => 604800]);
    return $result;
Esempio n. 24
0
/**
 * Attempt to check if a set of files can be written
 *
 * @param string[] $files fully qualified file names to check
 *
 * @return string[]|true true if no issues found, array
 */
function checkFileWriteablity($files)
{
    if (isset($_POST['op']) && $_POST['op'] === 'proceed') {
        return true;
        // user said skip this
    }
    $tmpStats = getTmpStats();
    if (false === $tmpStats) {
        return true;
        // tests are not applicable
    }
    $message = array();
    foreach ($files as $file) {
        $dirName = dirname($file);
        $fileName = basename($file);
        $dirStat = getStats($dirName);
        if (false !== $dirStat) {
            $uid = $tmpStats['uid'];
            $gid = $tmpStats['gid'];
            if (!($uid === $dirStat['uid'] && $dirStat['user']['write'] || $gid === $dirStat['gid'] && $dirStat['group']['write'] || file_exists($file) && is_writable($file) || false !== stripos(PHP_OS, 'WIN'))) {
                $uidStr = (string) $uid;
                $dUidStr = (string) $dirStat['uid'];
                $gidStr = (string) $gid;
                $dGidStr = (string) $dirStat['gid'];
                if (function_exists('posix_getpwuid')) {
                    $tempUsr = posix_getpwuid($uid);
                    $uidStr = isset($tempUsr['name']) ? $tempUsr['name'] : (string) $uid;
                    $tempUsr = posix_getpwuid($dirStat['uid']);
                    $dUidStr = isset($tempUsr['name']) ? $tempUsr['name'] : (string) $dirStat['uid'];
                }
                if (function_exists('posix_getgrgid')) {
                    $tempGrp = posix_getgrgid($gid);
                    $gidStr = isset($tempGrp['name']) ? $tempGrp['name'] : (string) $gid;
                    $tempGrp = posix_getgrgid($dirStat['gid']);
                    $dGidStr = isset($tempGrp['name']) ? $tempGrp['name'] : (string) $dirStat['gid'];
                }
                $message[] = sprintf(CHMOD_CHGRP_ERROR, $fileName, $uidStr, $gidStr, basename($dirName), $dUidStr, $dGidStr);
            }
        }
    }
    return empty($message) ? true : $message;
}
Esempio n. 25
0
    $myCalendar = new tc_calendar($name, true, false);
    $myCalendar->setIcon("images/iconCalendar.gif");
    $myCalendar->setDate(date('d', strtotime($default_date)), date('m', strtotime($default_date)), date('Y', strtotime($default_date)));
    $myCalendar->setPath("/stats/");
    $myCalendar->setYearInterval(1970, 2020);
    $myCalendar->setAlignment('left', 'bottom');
    $myCalendar->setDatePair('fm_date_start', 'fm_date_end');
    $myCalendar->writeScript();
}
// generateCalendarScript()
if ($fm_instance && in_array($fm_instance, $instanceList)) {
    $instances = array($fm_instance);
} else {
    $instances = $instanceList;
}
$stats = getStats($_SESSION['config'], $instances, $fm_date_start, $fm_date_end);
if ($fm_export) {
    if (exportStats($stats, $fm_summary)) {
        die;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<meta content="utf-8" http-equiv="encoding"/>
<link href="stats.css" rel="stylesheet" type="text/css"/>
<link href="calendar.css" rel="stylesheet" type="text/css"/>
<script language="javascript" src="calendar.js"></script>
<?php 
Esempio n. 26
0
function getStatsNotRecommended($userID, $length, $algorithm, $algType, $typeOfData, $from, $for)
{
    return getStats(0, $userID, 0, $length, $algorithm, $algType, $typeOfData, $from, $for);
}
Esempio n. 27
0
<?php

define('ROOT', dirname(__FILE__) . '/');
define('ROOT_CORE', ROOT . 'core/');
define('ROOT_CLASS', ROOT_CORE . 'class/');
require_once ROOT_CLASS . 'Config.class.php';
require_once ROOT_CLASS . 'T411API.class.php';
require_once ROOT_CLASS . 'MyTorrent.class.php';
require_once ROOT_CORE . 'functions.php';
error_reporting(0);
$stats = getStats();
$old_error_handler = set_error_handler("myErrorHandler");
$token = Config::$t411Tracker['token'];
$url = "http://tracker.t411.me:56969/" . $token . "/announce";
if (!empty($_GET['info_hash'])) {
    $url .= "?info_hash=" . urlencode($_GET['info_hash']);
}
foreach ($_GET as $key => $value) {
    switch ($key) {
        case "info_hash":
            // test
            break;
        case "peer_id":
            $url .= "&peer_id=" . urlencode($_GET['peer_id']);
            break;
        case "port":
            $url .= "&port=" . $_GET['port'];
            break;
        case "uploaded":
            $url .= "&uploaded=0";
            break;
Esempio n. 28
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect2.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/api/v1/functions.php';
header('Content-Type: application/json');
$data = array();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    $data = getStats($db, $_GET);
} else {
    $data = array('msg' => 'Not allowed request method', 'error' => true, 'status' => 405);
}
$json = str_replace('\\/', '/', json_encode($data));
print_r(pretty_json($json));
Esempio n. 29
0
						<strong>We need you!</strong><br/>
						That's right, if you own a web server running PHP, and has cURL installed, you can help run this website!<br/>
						Only one directory and one file needs to be on your server.<br/>
						Interested? <a href="/register/">Register now!</a>
		 			</p>
		 			
		 		<div class="spacing"></div>
		 		<h4>Your Statistics</h4>
		 		<?php 
getStats($_SESSION['UUID']);
?>
		 		
		 		<div class="spacing"></div>
		 		<h4>Global Statistics</h4>
		 		<?php 
getStats();
?>
		 		
	 		</div>
	 	</div>
	 </div>

	<?php 
getFooter();
?>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="/assets/js/bootstrap.min.js"></script>
	<script src="/assets/js/retina-1.1.0.js"></script>
	<script src="/assets/js/jquery.hoverdir.js"></script>
	<script src="/assets/js/jquery.hoverex.min.js"></script>
Esempio n. 30
0
?>
</form>
</div>

<form>
	<label>Choose URLs:</label>
<?php 
echo selectSlice($gSlice, "onchange='document.location=\"?a={$gArchive}&l={$gLabel}&s=\"+escape(this.options[this.selectedIndex].value)'");
?>
</form>

<div id=interesting style="margin-top: 40px;">
<?php 
require_once "stats.inc";
require_once "charts.inc";
$hStats = getStats($gLabel, $gSlice, curDevice());
$hCdf = getCdfData($gLabel, $gSlice, curDevice());
echo bytesContentTypeChart($hStats) . "\n";
echo responseSizes($hStats) . "\n";
echo histogram($hCdf, "bytesHtmlDoc", "HTML Document Transfer Size", "bytesHtmlDoc", 5 * 1024) . "\n";
echo histogram($hCdf, "numDomElements", "# of DOM Elements per Page", "numDomElements", 400, 2) . "\n";
echo percentGoogleLibrariesAPI($hStats) . "\n";
echo percentFlash($hStats) . "\n";
echo percentFonts($hStats) . "\n";
echo popularImageFormats($hStats) . "\n";
echo maxage($hStats) . "\n";
echo histogram($hCdf, "numRedirects", "Redirects per Page", "redirects") . "\n";
echo histogram($hCdf, "_connections", "Connections per Page", "connections", 10) . "\n";
echo histogram($hCdf, "avg_dom_depth", "Avg DOM Depth", "avgdomdepth") . "\n";
echo histogram($hCdf, "document_height", "Document Height (pixels)", "docheight", 1000) . "\n";
echo histogram($hCdf, "localstorage_size", "Size of localStorage (chars)", "localstorage", 50) . "\n";