Skip to content

Instantly share code, notes, and snippets.

@marfillaster
Created January 29, 2010 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marfillaster/289425 to your computer and use it in GitHub Desktop.
Save marfillaster/289425 to your computer and use it in GitHub Desktop.
<?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