From dfc1af4965714e49bf5d08b40e34d01a78205828 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 14 May 2013 12:45:00 +0200 Subject: [PATCH] get both valid and invalid user shares --- public/include/classes/user.class.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 32ad8380..24e4484c 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -172,11 +172,22 @@ class User { SELECT ROUND(COUNT(id) * POW(2,21)/600/1000) FROM shares WHERE $this->table.username = SUBSTRING_INDEX( `username` , '.', 1 ) AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) ) AS hashrate, ( - SELECT COUNT(id) FROM shares WHERE $this->table.username = SUBSTRING_INDEX( `username` , '.', 1 ) AND UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(time) FROM blocks),0) - ) AS shares + SELECT COUNT(id) + FROM shares + WHERE $this->table.username = SUBSTRING_INDEX( `username` , '.', 1 ) + AND UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(time) FROM blocks),0) + AND our_result = 'Y' + ) AS valid, + ( + SELECT COUNT(id) + FROM shares + WHERE $this->table.username = SUBSTRING_INDEX( `username` , '.', 1 ) + AND UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(time) FROM blocks),0) + AND our_result = 'N' + ) AS invalid FROM $this->table WHERE id = ? LIMIT 0,1"); -echo $this->mysqli->error; + echo $this->mysqli->error; if ($this->checkStmt($stmt)) { $stmt->bind_param('i', $userID); if (!$stmt->execute()) {