public function __construct() { global $couch_queries; if ($_COOKIE[APF]) { // if the cookie is presnet check to see if it is in the DB and if not then we can deauthenticate if (self::sess_check($_COOKIE[APF]) != false) { } else { // PUT YOUR INVALID MESSAGE HERE ... return false; } unset($this->username, $this->password); } if (isset($_POST['username']) && $_POST['password'] != NULL) { $result = couchCurl::view($_POST['username'], 'username', DESIGN_DOC, APF . '_users', NULL); $couch_queries++; foreach ($result['rows'] as $key => $value) { $uid = $key; $pass_hash = $value; // only process the top most row, this shouldn't have more than one entry end; } if ($pass_hash == md5(trim($_POST['password']))) { return self::gen_cookie($uid); } else { // SHOW INVALID LOGIN return false; die; } } }