function sendFirstUpdates() { global $prefs, $overrideNickname; $this->updates = array(); $ys = ys($_SESSION['yLog']); $posts = $ys->latestPosts($prefs['truncate']); $this->setSessTimestamp($posts); $this->updates['posts'] = $posts; $this->updates['prefs'] = $this->cleanPrefs($prefs); if ($nickname = cookieGet('yNickname')) { $this->updates['nickname'] = $nickname; } if ($overrideNickname) { $this->updates['nickname'] = $overrideNickname; } if ($ys->banned(ip())) { $this->updates['banned'] = true; } echo jsonEncode($this->updates); }
function loggedIn() { global $prefs; $loginHash = cookieGet('yLoginHash', false); // echo 'loggedin: ' . $loginHash . "\n"; // echo 'pw: ' . $prefs['password'] . "\n"; if (isset($loginHash)) { return $loginHash == md5($prefs['password']); } if (isset($_SESSION['yLoginHash'])) { return $_SESSION['yLoginHash'] == md5($prefs['password']); } return false; }