Otóż mamy sobie taką klasę :
<?php
class TurAuthenticate{
private $isAuthenticated = false;
private $oUser;
private $oSession;
public function __construct(){
$this->oSession = new TurSession('UserSession');
if(!isset($this->oSession->userId))$this->oSession->userId = -1; $this->oUser = new TurUser('id',$this->oSession->userId);
$this->IsAuthenticated = $this->oSession->isAuthenticated;
}
public function isAuth(){
return $this->isAuthenticated;
}
public function signOut(){
$this->oSession->userId = -1;
$this->oUser = null;
$this->isAuthenticated = false;
$this->oSession->isAuthenticated = false;
}
public function signIn($name,$pass){
$this->oUser = new TurUser('name',$name);
if($this->oUser->pass = $pass){
$this->isAuthenticated = true;
$this->oSession->isAuthenticated = true;
$this->oSession->userId = $this->oUser->id;
}
}
}
?>
Ale problem pojawia się gdy trzeba wywalić sesję. Zliczyć je, to dopiero masakra... Jakieś konkretne propozycje ?
Może własny SessionHandler ? Na bazie ? Jak tak to mySQL czy coś innego? Jak to robić ?