Created
January 29, 2010 03:41
-
-
Save marfillaster/289425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ExclusiveSecurityFilter extends sfFilter | |
{ | |
public function execute($filterChain) | |
{ | |
if($this->context->getUser()->isAuthenticated() | |
&& session_id() != $this->context->getUser()->getProfile()->getSessionId() | |
&& $this->context->getUser()->getProfile()->getLastLoginIp() != $this->context->getRequest()->getRealRemoteAddress() | |
) | |
{ | |
$this->context->getUser()->signOut(); | |
$this->context->getUser()->setFlash('error', 'Account is being used in another machine.'); | |
$this->context->getController()->redirect($this->context->getRequest()->getUri()); | |
throw new sfStopException(); | |
} | |
$filterChain->execute(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment