當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stats::usersharecount方法代碼示例

本文整理匯總了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);
開發者ID:neofutur,項目名稱:simplecoin,代碼行數:31,代碼來源:api.php


注:本文中的Stats::usersharecount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。