当前位置: 首页>>代码示例>>PHP>>正文


PHP getStat函数代码示例

本文整理汇总了PHP中getStat函数的典型用法代码示例。如果您正苦于以下问题:PHP getStat函数的具体用法?PHP getStat怎么用?PHP getStat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getStat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStatName

function getStatName($stat)
{
    if (!is_array($stat)) {
        $stat = getStat($stat);
    }
    return array("name" => $stat['name'], "fullName" => $stat['fullName']);
}
开发者ID:gordonc64,项目名称:CellAO-WebCore,代码行数:7,代码来源:stats.php

示例2: getCpuUsage

 function getCpuUsage($_statPath = '/proc/stat')
 {
     $msge = "<div id='getCpuUsage'><small class='r'>getCpuUsage():<br />couldn't access STAT path</small></div><script type='text/javascript'>function killElement(){ document.getElementById('getCpuUsage').style.display='none'; } setTimeout('killElement()', 5000);</script>";
     $time1 = getStat($_statPath) or false;
     sleep(1);
     $time2 = getStat($_statPath) or false;
     $delta = array();
     if ($time1 != false && $time2 != false) {
         foreach ($time1 as $k => $v) {
             $delta[$k] = $time2[$k] - $v;
         }
         $deltaTotal = array_sum($delta);
         $percentages = array();
         foreach ($delta as $k => $v) {
             $percentages[$k] = @round($v / $deltaTotal * 100, 2);
         }
         return $percentages;
     } else {
         return $msge;
         //return false;
     }
 }
开发者ID:laiello,项目名称:rapidleech36b,代码行数:22,代码来源:sinfo.php

示例3: function

         $tripod->saveChanges($oldGraph, new \Tripod\ExtendedGraph());
     });
     $app->post('/', function ($storeName, $podName) use($app, $tripodOptions) {
         $tripodOptions['statsConfig'] = getStat($app, $tripodOptions);
         $tripod = new \Tripod\Mongo\Driver($podName, $storeName, $tripodOptions);
         $rawGraphData = $app->request()->getBody();
         $graph = new \Tripod\Mongo\MongoGraph();
         $graph->add_rdf($rawGraphData);
         $tripod->saveChanges(new \Tripod\ExtendedGraph(), $graph);
     });
 });
 $app->group('/change', function () use($app, $tripodOptions) {
     $app->post('/', function ($storeName, $podName) use($app, $tripodOptions) {
         \Tripod\Mongo\Config::setConfig(json_decode(file_get_contents('./config/tripod-config-' . $storeName . '.json'), true));
         $app->response()->setStatus(500);
         $tripodOptions['statsConfig'] = getStat($app, $tripodOptions);
         $tripod = new \Tripod\Mongo\Driver($podName, $storeName, $tripodOptions);
         $rawChangeData = $app->request()->post('data');
         if ($rawChangeData) {
             $changeData = json_decode($rawChangeData, true);
             $from = new \Tripod\Mongo\MongoGraph();
             $to = new \Tripod\Mongo\MongoGraph();
             if (isset($changeData['originalCBDs'])) {
                 foreach ($changeData['originalCBDs'] as $change) {
                     if (is_array($change) && isset($change[_ID_KEY])) {
                         $from->add_tripod_array($change);
                     }
                 }
             }
             if (isset($changeData['newCBDs'])) {
                 foreach ($changeData['newCBDs'] as $change) {
开发者ID:talis,项目名称:tripod-php,代码行数:31,代码来源:index.php

示例4: header

<?php

include_once "include/check_login.php";
if ($user_ok == false) {
    header('location: restricted.php?refPage=mydecks');
}
/******************************************************************************************************************/
require_once 'stats.php';
$pid = getUserID($_SESSION['username']);
$lv = getStat('lv', $pid);
$pDecks = getUserDecks($pid);
$pDecksSrtAscArr = sortDeckArrDN($pDecks);
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>My Decks </title>
	<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
	<link rel="stylesheet" type="text/css" href="css/readable.bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/newStyle.css">
	<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
	<!--<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">-->
	<!--[if lt IE 9]>
	<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
	<script type="text/javascript">
		<!-- 
		//Browser Support Code
		function _(el){
开发者ID:Knixd,项目名称:JPVocab,代码行数:31,代码来源:mydecks.php

示例5: getPvpRank

	<link rel="stylesheet" type="text/css" href="css/newStyle.css">
	<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
</head>
<body>
	<div class="row">
		<div class="col-md-2"></div>
		<div class="col-md-8 table-responsive">
			<h1>PVP</h1>
			<?php
			$i =2;
			foreach($pvpDis as $rank){?>
				<div class="row">
					<div class="col-xs-12">
						<?= getPvpRank(getPvpUI($pvpDis[$i])); ?>
						<span id="user<?= $i;?>"><?= getUserDetail(getPvpUI($pvpDis[$i]),'username'); ?>, </span>
						Lvl <?= getStat('lv',getPvpUI($pvpDis[$i])); ?>
						<a href="#3" id="battle<?= $i;?>" name="">Battle</a>
					</div>
				</div><?
				$i--;
			} ?>
			
			
		</div>
		<div class="col-md-2"></div>
	</div>
	<script>
		var battle2 = document.getElementById("battle2");
		var battle1 = document.getElementById("battle1");
		var battle0 = document.getElementById("battle0");
		var user2 = document.getElementById("user2").innerHTML;
开发者ID:Knixd,项目名称:JPVocab,代码行数:31,代码来源:pvp.php

示例6: getCpuUsage

 function getCpuUsage($_statPath = '/proc/stat')
 {
     $time1 = getStat($_statPath);
     if (!$time1) {
         return -1;
     }
     sleep(1);
     $time2 = getStat($_statPath);
     $delta = array();
     foreach ($time1 as $k => $v) {
         $delta[$k] = $time2[$k] - $v;
     }
     $deltaTotal = array_sum($delta);
     $percentages = array();
     foreach ($delta as $k => $v) {
         $percentages[$k] = @round($v / $deltaTotal * 100, 2);
     }
     return $percentages;
 }
开发者ID:SheppeR,项目名称:rapidleech,代码行数:19,代码来源:sinfo.php

示例7: getStat

<?php

require_once "auth.php";
require_once "smarty.php";
require_once "backend/functions.php";
$stat = getStat();
$smarty->assign("users_all", $stat['Users']['All']);
$smarty->assign("users_admin", $stat['Users']['Admin']);
$smarty->assign("FiberSplice_NetworkNodesCount", $stat['FiberSplice']['NetworkNodesCount']);
$smarty->assign("NetworkNodeCountInFiberSplice", $stat['FiberSplice']['NetworkNodeCountInFiberSplice']);
$smarty->assign("FiberSplice_FiberSpliceCount", $stat['FiberSplice']['FiberSpliceCount']);
$smarty->assign("CableLinePointCount", $stat['CableLinePoint']['Count']);
$smarty->assign("NetworkNodesCount", $stat['NetworkNode']['Count']);
$smarty->assign("NetworkBoxesCount", $stat['NetworkBox']['Count']);
$smarty->display("index.tpl");
开发者ID:nitr0man,项目名称:fiberms,代码行数:15,代码来源:index.php

示例8: session_start

<?php

session_start();
$name = $_SESSION['username'];
include $_SERVER['DOCUMENT_ROOT'] . '/include/db_browsergame.inc.php';
require $_SERVER['DOCUMENT_ROOT'] . '/browsergame/inc/logincheck.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/browsergame/functions/stats.function.php';
$setHP = getStat('sethp', $userID);
if ($setHP == 0) {
    setStat('curhp', $userID, 10);
    setStat('maxhp', $userID, 10);
    setStat('sethp', $userID, 1);
}
$attack = getStat('atk', $userID);
$magic = getStat('mag', $userID);
$defence = getStat('def', $userID);
$gold = getStat('gc', $userID);
$currentHP = getStat('curhp', $userID);
$maximumHP = getStat('maxhp', $userID);
require "main.html.php";
开发者ID:Hjorvar,项目名称:bbg,代码行数:20,代码来源:index.php

示例9: COUNT

    $msg = '	Total citations ignored for IA: ';
    $sql = "SELECT COUNT(DISTINCT nid) AS total FROM citebank_internet_archive_records WHERE archive_status = -1";
    getStat($dbi, $msg, $sql);
    $totalCitationsExternallyHosted = $totalCitations - $totalIACitations;
    echo '<br>';
    $msg = '	Citations in CB (externally hosted content files): ';
    echo $msg . $totalCitationsExternallyHosted;
    // ****************************************
    // ****************************************
    // ****************************************
} else {
    // just public stats
    // total citations
    $msg = '	Total citations: ';
    $sql = "SELECT COUNT(*) AS total FROM node AS n JOIN biblio AS b ON (n.nid = b.nid) WHERE n.type = 'biblio'";
    getStat($dbi, $msg, $sql);
}
statsEchoLine();
/*
 *
 */
function getStat($dbi, $msg, $sql)
{
    $rows = $dbi->fetch($sql);
    $count = 0;
    if (count($rows) > 0) {
        $count = $rows[0]['total'];
    }
    echo '<br>';
    echo $msg . $count;
    return $count;
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:31,代码来源:citebankstatspage.php

示例10: seoPages

 private function seoPages($task)
 {
     $mainframe =& JFactory::getApplication();
     $this->addSubmenu('pages_view');
     require_once "classes/MetatagsContainerFactory.php";
     $itemType = JRequest::getVar('type', null, '', 'string');
     if (!$itemType) {
         $itemType = key(MetatagsContainerFactory::getFeatures());
     }
     $metatagsContainer = MetatagsContainerFactory::getContainerById($itemType);
     if (!is_object($metatagsContainer)) {
         //TODO: throw error here.
     }
     switch ($task) {
         case "pages_save_text":
             $metatagsContainer->setMetadata($id = JRequest::getVar('id', '', '', 'int'), array("title" => JRequest::getVar('title', '', '', 'string'), "metatitle" => JRequest::getVar('metatitle', '', '', 'string'), "metakeywords" => JRequest::getVar('metakeywords', '', '', 'string'), "metadescription" => JRequest::getVar('metadescription', '', '', 'string')));
             echo "<script>window.parent.document.adminForm.submit();</script>";
             break;
         case "pages_edit_text":
             $id = JRequest::getVar('id', '', '', 'int');
             $data = $metatagsContainer->getMetadata($id);
             $data["id"] = $id;
             $view =& $this->getView('Pages');
             $view->assignRef('itemType', $itemType);
             $view->assignRef('data', $data);
             $view->display('edit');
             break;
         default:
             $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'));
             $limitstart = JRequest::getVar('limitstart', 0);
             $db =& JFactory::getDBO();
             $pages = $metatagsContainer->getPages($limitstart, $limit);
             $db->setQuery('SELECT FOUND_ROWS();');
             //no reloading the query! Just asking for total without limit
             jimport('joomla.html.pagination');
             $pageNav = new JPagination($db->loadResult(), $limitstart, $limit);
             require_once "algorithm/KeywordsCounter.php";
             for ($i = 0; $i < count($pages); $i++) {
                 $stat_arr = array();
                 for ($j = 0; $j < count($pages[$i]->metakey); $j++) {
                     $stat_arr[] = getStat($pages[$i]->metakey[$j], $pages[$i]->content);
                 }
                 $pages[$i]->stat = $stat_arr;
             }
             $view =& $this->getView('Pages');
             $view->assignRef('itemType', $itemType);
             $view->assignRef('rows', $pages);
             $view->assignRef('page', $page);
             $view->assignRef('itemsOnPage', $itemsOnPage);
             $view->assignRef('filter', $metatagsContainer->getFilter());
             $view->assignRef('availableTypes', MetatagsContainerFactory::getFeatures());
             $view->assignRef('pageNav', $pageNav);
             $view->display();
     }
 }
开发者ID:Rikisha,项目名称:proj,代码行数:55,代码来源:controller.php

示例11: session_start

<?php

session_start();
include '../stats.php';
echo getStat('gc', getUserID(preg_replace('#[^a-z0-9]#i', '', $_SESSION['username'])));
开发者ID:Knixd,项目名称:JPVocab,代码行数:5,代码来源:updateGoldScript.php

示例12: getSomeDecks

			<div class="row"><?php
				$someDecks = getSomeDecks($t);
				$j=0;
				foreach($someDecks as $row => $deck){
					if(!$deck['is_sentences']){
						$deckOwners = countDeckOwners($deck['display_name']);
						if($j % 2 == 0){ ?><div class="clearfix visible-sm"></div><? }
						if($j % 3 == 0){ ?><div class="clearfix visible-md visible-lg"></div><? }?>
						<div class="col-sm-6 col-md-4">
							<div class="thumbnail">
							  <img src="../img/<?= $deck['picture'];?>" class="img-responsive" alt="<?= $deck['display_name'];?> Vocabulary" class="img-responsive">
							  <div class="caption">
								<h4><a href="http://www.JPVocab.com/Japanese-Vocabulary/deck.php?t=<?= $t;?>&d=<?= $deck['display_url']; ?>"><?= $deck['display_name'];?></a></h4>
								<p>
									 
									<a href="#2" data-toggle="popover" title="Deck Owners" data-content="<? if($user_ok ==false){ echo "Oh hey! You need to <strong>Login</strong> to do that.";}else{ foreach($deckOwners as $row => $user){ echo "<a href='http://www.jpvocab.com/player.php?player=".$user['username']."&report=summary'>". $user['username'] ."</a> <i class='text-muted small '>Lvl <strong>".getStat('level',$user['id'])."</strong></i><br />"; } }?>" data-trigger="focus" data-html="true"><small><strong><?= sizeOf($deckOwners); ?></strong> Users</a> Own This Deck</small>
								</p>
								<p><?= $deck['description'];?></p>
								<p>
									<a href="http://www.JPVocab.com/Japanese-Vocabulary/deck.php?t=<?= $t;?>&d=<?= $deck['display_url']; ?>" class="btn btn-default btn-block" role="button">Interested?</a>
								</p>
							  </div>
							</div>
						</div><?php
						$j++;
					}
				}?>
				<!--<small><a href="http://www.JPVocab.com/flashcard-rewards.php" alt="Japanese flashcard reward system">What the heck are <span class="label label-warning">Gold</span> and <span class="label label-default">Diamonds</span>?</a></small>-->
			</div>
		</div>
	</div>
开发者ID:Knixd,项目名称:JPVocab,代码行数:31,代码来源:template-display-decks.php

示例13: sprintf

         if ($count > 0) {
             # already has one of the item
             $query = sprintf("UPDATE user_items SET quantity = quantity + 1 WHERE user_id = '%s' AND item_id = '%s'", mysql_real_escape_string($userID), mysql_real_escape_string($itemID));
         } else {
             # has none - new row
             $query = sprintf("INSERT INTO user_items(quantity,user_id,item_id) VALUES (1,'%s','%s')", mysql_real_escape_string($userID), mysql_real_escape_string($itemID));
         }
         mysql_query($query);
         # retrieve the item name, so that we can display it
         $query = sprintf("SELECT name FROM items WHERE id = %s", mysql_real_escape_string($itemID));
         $result = mysql_query($query);
         list($itemName) = mysql_fetch_row($result);
         $smarty->assign('item', $itemName);
         $monster_exp = getMonsterStat('exp', $monsterID);
         $smarty->assign('exp', $monster_exp);
         $exp_rem = getStat('exp_rem', $userID);
         $exp_rem -= $monster_exp;
         $level_up = 0;
         if ($exp_rem <= 0) {
             // level up!
             $exp_rem = 100;
             $level_up = 1;
         }
         $smarty->assign('level_up', $level_up);
         setStat('exp_rem', $userID, $exp_rem);
     } else {
         // monster won
         $smarty->assign('lost', 1);
     }
     $smarty->assign('combat', $combat);
 } else {
开发者ID:LoveLeAnon,项目名称:building-browsergames-tutorial,代码行数:31,代码来源:explore.php

示例14: setMoneyBalances

function setMoneyBalances($sElement, $sMethod, $userId)
{
    $userFunds = getStat($sMethod, $userId);
    $elementP = getPrice($sElement, $sMethod);
    $balance = $userFunds - $elementP;
    if ($balance >= 0) {
        setStat($sMethod, $userId, $balance);
        return 'success';
    }
}
开发者ID:Knixd,项目名称:JPDrills,代码行数:10,代码来源:stats.php

示例15: session_start

<?php

require_once 'smarty.php';
session_start();
require_once 'config.php';
// our database settings
require_once 'stats.php';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);
// retrieve user ID
$query = sprintf("SELECT id FROM users WHERE UPPER(username) = UPPER('%s')", mysql_real_escape_string($_SESSION['username']));
$result = mysql_query($query);
list($userID) = mysql_fetch_row($result);
if ($_POST) {
    $amount = $_POST['amount'];
    $gold = getStat('gc', $userID);
    $needed = getStat('maxhp', $userID) - getStat('curhp', $userID);
    if ($amount > $needed || $amount == '') {
        $amount = $needed;
    }
    if ($amount > $gold) {
        $amount = $gold;
    }
    setStat('gc', $userID, getStat('gc', $userID) - $amount);
    setStat('curhp', $userID, getStat('curhp', $userID) + $amount);
    $smarty->assign('healed', $amount);
}
$smarty->assign('curhp', getStat('curhp', $userID));
$smarty->assign('maxhp', getStat('maxhp', $userID));
$smarty->assign('gold', getStat('gc', $userID));
$smarty->display('healer.tpl');
开发者ID:LoveLeAnon,项目名称:building-browsergames-tutorial,代码行数:31,代码来源:healer.php


注:本文中的getStat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。