diff options
| author | Carson Fleming <cflems@cflems.net> | 2017-02-16 23:59:34 -0500 |
|---|---|---|
| committer | Carson Fleming <cflems@cflems.net> | 2017-02-16 23:59:34 -0500 |
| commit | 4f12fecebcd3f2a5bc6a0e7cdf9c420af4ed435a (patch) | |
| tree | edd91e33b95d48022bca9ce8c0626a7a7879af93 /inc | |
| parent | 5564b3a9cb432f1f7eb76bd325251312904bb893 (diff) | |
| download | bulletin-4f12fecebcd3f2a5bc6a0e7cdf9c420af4ed435a.tar.gz | |
Did the profile
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/user.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/inc/user.php b/inc/user.php index 789586f..cf0dde8 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 * FROM users WHERE id = '.intval($matches[1]).' AND session = \''.hash('sha512', $matches[2]).'\' AND active = 1 LIMIT 1') or fatal($db->error); + $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 = \''.hash('sha512', $matches[2]).'\' AND users.active = 1 LIMIT 1') or fatal($db->error); if ($result->num_rows < 1) $b_user = $guest_user; else $b_user = $result->fetch_assoc(); $result->free(); |
