Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // check to find the post breakdown of the user
  2. $query = "SELECT 'total' as `k`, count(c.`id`) as v
  3.          FROM `".DB_PREF."comments` c
  4.          WHERE c.`author_hash`='$key'
  5.          GROUP BY c.`author_hash`
  6.            UNION
  7.          SELECT 'totalvisible' as `k`, count(c.`id`) as v
  8.          FROM `".DB_PREF."comments` c
  9.          WHERE c.`author_hash`='$key'
  10.          AND c.`visible`=1
  11.          GROUP BY c.`author_hash`
  12.            UNION
  13.          SELECT 'totaldead' as `k`, count(c.`id`) as v
  14.          FROM `".DB_PREF."comments` c
  15.          WHERE c.`author_hash`='$key'
  16.          AND c.`visible`!=1
  17.          GROUP BY c.`author_hash`
  18.            UNION
  19.          SELECT 'killed' as `k`, count(c.`id`) as v
  20.          FROM `".DB_PREF."comments` c
  21.          WHERE c.`author_hash`='$key'
  22.          AND c.`visible`=0
  23.          GROUP BY c.`author_hash`
  24.            UNION
  25.          SELECT 'autokilled' as `k`, count(c.`id`) as v
  26.          FROM `".DB_PREF."comments` c
  27.          WHERE c.`author_hash`='$key'
  28.          AND c.`visible`=-1
  29.          GROUP BY c.`author_hash`
  30.            UNION
  31.          SELECT 'spam' as `k`, count(c.`id`) as v
  32.          FROM `".DB_PREF."comments` c
  33.          WHERE c.`author_hash`='$key'
  34.          AND c.`visible`=-2
  35.          GROUP BY c.`author_hash`";
  36.  
  37. $result = run_query($query);
  38. $breakdown = array();
  39. while ($row = mysqli_fetch_assoc($result)) {
  40.     $breakdown[$row['k']] = intval($row['v']);
  41. }
  42. mysqli_free_result($result);