本文整理匯總了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);