Beispiel #1
0
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
// 	  BTC Donations: 163Pv9cUDJTNUbadV4HMRQSSj3ipwLURRc
include dirname(__FILE__) . "/../includes/requiredFunctions.php";
include $includedir . "stats.php";
$stats = new Stats();
//Check that script is run locally
ScriptIsRunLocally();
//Remove cached items (in case they get stuck)
removeCache("worker_hashrates");
removeCache("pool_hashrate");
removeCache("user_hashrates");
//Hashrate by user
$hashrates = $stats->userhashratesbyid();
mysql_query("BEGIN");
$i = 0;
$sql = "";
foreach ($hashrates as $userid => $hashrate) {
    if ($i == 0) {
        $sql = "INSERT INTO userHashrates (userId, hashrate) VALUES ";
    } else {
        $sql .= ",";
    }
    $i++;
    $sql .= "({$userid}, {$hashrate})";
    if ($i > 20) {
        mysql_query($sql);
        $sql = "";
        $i = 0;