コード例 #1
0
 public final function ecrire($idSession, $donneesSession)
 {
     if ($donneesSession === NULL) {
         return TRUE;
     } else {
         if (!$this->charger($idSession)) {
             $this->record = ORM::forTable(self::NOM_TABLE)->create();
         }
         $this->record->id_session = $idSession;
         $this->record->valeur_session = Securite::crypter($donneesSession);
         $this->record->ip_utilisateur = Outil::getAdresseIP();
         $this->record->setExpr('date_activite', 'NOW()');
         return (bool) $this->record->save();
     }
 }
コード例 #2
0
ファイル: BlocageIP.class.php プロジェクト: RedaB/PHPBase
 public static final function estBloquee($adresseIP = NULL)
 {
     $adresseIP = $adresseIP === NULL ? Outil::getAdresseIP() : (string) $adresseIP;
     return (bool) ORM::forTable(self::NOM_TABLE)->selectExpr('COUNT(1)', 'nombre')->where('ip_blocage', $adresseIP)->whereRaw('NOW() - `date_blocage` <= ?', array(self::DUREE_BLOCAGE))->findOne()->nombre;
 }