From 3d0d3a86106ece4ea298ab2f262b3af5ff8a7728 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sat, 11 Mar 2017 01:29:13 -0800 Subject: Almost there... --- inc/user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/user.php') diff --git a/inc/user.php b/inc/user.php index 878a086..70bc646 100644 --- a/inc/user.php +++ b/inc/user.php @@ -9,7 +9,7 @@ if (empty($_COOKIE[$b_config['c_name']]) || !preg_match('/^(\d+);([0-9a-zA-Z\.]+ } else { $db = new bdb(); - $result = $db->query('SELECT users.*, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM users LEFT JOIN ratings ON ratings.rated = users.id WHERE users.id = '.intval($matches[1]).' AND users.session = \''.bulletin_hash($matches[2]).'\' AND users.active = 1 LIMIT 1') or fatal($db->error); + $result = $db->query('SELECT users.*, SUM(ratings.stars) / COUNT(ratings.stars) AS rating, COUNT(notif.id) AS notif FROM users LEFT JOIN ratings ON ratings.rated = users.id LEFT JOIN notif ON notif.uid = users.id AND notif.seen = 0 WHERE users.id = '.intval($matches[1]).' AND users.session = \''.bulletin_hash($matches[2]).'\' AND users.active = 1 GROUP BY users.id LIMIT 1') or fatal($db->error); if ($result->num_rows < 1) $b_user = $guest_user; else $b_user = $result->fetch_assoc(); $result->free(); -- cgit v1.2.3