本文整理汇总了PHP中Stats::usersharecount方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::usersharecount方法的具体用法?PHP Stats::usersharecount怎么用?PHP Stats::usersharecount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::usersharecount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: User
$apikey = mysql_real_escape_string($_GET["api_key"]);
$user = new User();
$userid = 0;
$resultU = mysql_query_cache("SELECT u.id, b.balance, b.paid, u.username from webUsers u, accountBalance b WHERE u.id = b.userId AND u.api_key = '{$apikey}'", 300);
if (count($resultU) > 0) {
$userobj = $resultU[0];
$username = $userobj->username;
$userid = $userobj->id;
$user->confirmed_rewards = $userobj->balance;
$user->hashrate = $stats->userhashrate($username);
$user->estimated_rewards = 0;
$user->payout_history = $userobj->paid;
if (is_numeric($settings->getsetting("sitepercent"))) {
$sitePercent = $settings->getsetting("sitepercent");
}
$totalUserShares = $stats->usersharecount($userid);
//Get current round share information, estimated total earnings
$totalOverallShares = $stats->currentshares();
//Prevent divide by zero
if ($totalUserShares > 0 && $totalOverallShares > 0) {
//Get site percentage
$sitePercent = 0;
if (is_numeric($settings->getsetting('sitepercent'))) {
$sitePercent = $settings->getsetting('sitepercent') / 100;
}
if ($totalOverallShares > $bitcoinDifficulty) {
$estimatedTotalEarnings = $totalUserShares / $totalOverallShares;
} else {
$estimatedTotalEarnings = $totalUserShares / $bitcoinDifficulty;
}
$estimatedTotalEarnings *= $bonusCoins * (1 - $sitePercent);