summaryrefslogtreecommitdiff
path: root/inc/user.php
diff options
context:
space:
mode:
authorBulletin <bulletin@bulletinalpha.tk>2016-12-29 16:42:32 -0500
committerBulletin <bulletin@bulletinalpha.tk>2016-12-29 16:42:32 -0500
commit1a7fa60f6cb2ee26843ca19e37bb4ff44104ad55 (patch)
tree2fa1fbdea9992ab63ba2a7abbac8bbcd633d13f7 /inc/user.php
downloadbulletin-1a7fa60f6cb2ee26843ca19e37bb4ff44104ad55.tar.gz
Added existing progress
Diffstat (limited to 'inc/user.php')
-rw-r--r--inc/user.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/inc/user.php b/inc/user.php
new file mode 100644
index 0000000..789586f
--- /dev/null
+++ b/inc/user.php
@@ -0,0 +1,18 @@
+<?php
+global $b_user;
+$guest_user = array(
+ 'id' => 0,
+);
+
+if (empty($_COOKIE[$b_config['c_name']]) || !preg_match('/^(\d+);([0-9a-zA-Z\.]+)$/', $_COOKIE[$b_config['c_name']], $matches)) {
+ $b_user = $guest_user;
+}
+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);
+ if ($result->num_rows < 1) $b_user = $guest_user;
+ else $b_user = $result->fetch_assoc();
+ $result->free();
+ $db->close();
+}
+?>