Exemple #1
0
 private function ecrire_journal()
 {
     $nom_journal = _XML_PATH_MAIL . _XML_MAIL_JOURNAL . _XML_EXT;
     $nom_modele_journal = _XML_PATH_INTERNE . _XML_MAIL_MODELE_JOURNAL . _XML_EXT;
     $this->anti_flooding = @copy($nom_modele_journal, $nom_journal);
     if ($this->anti_flooding) {
         $xml_journal = new xml_struct();
         $this->anti_flooding = $xml_journal->ouvrir($nom_journal);
     }
     if ($this->anti_flooding) {
         @chmod($nom_journal, 0600);
         $horodatage_reference = time();
         foreach ($this->tab_journal as $adr_ip => $obj_ip) {
             $horodatage_echec = $obj_ip->get_horodatage_echec();
             $horodatage_succes = $obj_ip->get_horodatage_succes();
             $comptage_envois = $obj_ip->get_comptage_envois();
             $delai_echec = $horodatage_reference - $horodatage_echec;
             $delai_succes = $horodatage_reference - $horodatage_succes;
             // Les infos datant de plus de 24 heures sont purgées
             if ($delai_echec <= 86400 || $delai_succes <= 86400) {
                 $xml_journal->pointer_sur_origine();
                 $xml_journal->add_balise($adr_ip);
                 $xml_journal->pointer_sur_balise($adr_ip);
                 $xml_journal->add_balise_valeur(_MAIL_FLOOD_HORODATAGE_ECHEC, $horodatage_echec);
                 $xml_journal->add_balise_valeur(_MAIL_FLOOD_HORODATAGE_SUCCES, $horodatage_succes);
                 $xml_journal->add_balise_valeur(_MAIL_FLOOD_COMPTAGE_ENVOIS, $comptage_envois);
             }
         }
         $xml_journal->pointer_sur_origine();
         $xml_journal->enregistrer($nom_journal);
     }
 }