Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Custom_Session extends Hm_Memcached_Session {
- /**
- * check for an active session or an attempt to start one
- * @param object $request request object
- * @return bool
- */
- public function check($request, $user=false, $pass=false, $fingerprint=true) {
- /* active session */
- if (array_key_exists($this->cname, $request->cookie)) {
- $this->get_key($request);
- $this->start($request, true);
- }
- /* no active session, check for login state */
- if (!$this->is_active()) {
- /* use whatever code you need to determine if a user is logged in,
- * and get there username, if they should be logged into cypht,
- * do the following:
- */
- $this->start($request);
- $this->set('username', $your_user_name);
- }
- /* active session but logged out of your app, so log out of cypht */
- else {
- /* check to see if a user is logged OUT of your app, and if so
- * call the following
- */
- $this->destroy($request);
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement