ressource_file = $myRessource->getFile(); $this->data = $myData; $resource = \fopen( $this->ressource_file.".log" ,'a' ); $toWrite= date("Y-m-d H:i:s" ,$this->data['time']).\PHP_EOL; \fwrite( $resource, $toWrite, strlen( $toWrite ) ); \fflush( $resource ); \fclose( $resource ); } public function getRessource() : Ressource { return unserialize( file_get_contents( $this->ressource_file.".dbphp" ) ); } public function writeXml( $xml ,$child ) { $xmlMyRessource = $xml->createElement( "access" ); foreach( $this->data as $key => $data ) $xmlMyRessource->appendChild( $xml->createElement( $key, $data ) ); $child->appendChild( $xmlMyRessource ); return $xmlMyRessource; } // /darkauth\db\auth\Access::listToXml( $xml ,$child ) public static function listToXml( $xml ,$child ) { $xmlAccess = $xml->createElement( "access" ); $child->appendChild( $xmlAccess ); /* foreach( scandir( \darkauth\db\auth\Ip::$ipsDir ) as $anValue ) if ( is_dir( ( $anIpDir = \darkauth\db\auth\Ip::$ipsDir."/$anValue" ) ) ) foreach( scandir( $anIpDir ) as $anOtherValue ) if ( is_dir( ( $anBrowserDir = "{$anIpDir}/{$anOtherValue}" ) ) ) foreach( scandir( $anBrowserDir ) as $anLastOtherValue ) if ( is_dir( ( $anDeviceDir = "{$anBrowserDir}/{$anLastOtherValue}" ) ) ) foreach( scandir( $anDeviceDir ) as $anPoueLastOtherValue ) if ( is_file( ( $serializedFile = "{$anDeviceDir}/{$anPoueLastOtherValue}" ) ) && \darkphp\string\DwString::endsWith( $serializedFile ,".dbphp" ) ) ( unserialize( file_get_contents( $serializedFile ) ) )->writeXml( $xml, $xmlAccess ); //*/ return $xmlAccess; } // \darkauth\db\Access::fromApache2( $myRessource ,$_SERVER ); public static function fromApache2( Ressource $myRessource ,$myServer ) : ?self { $utcTime=$myServer['REQUEST_TIME']; $timezone = new \DateTimeZone('Europe/Paris'); $time=$utcTime+$timezone->getOffset( new \DateTime() ); return new self( $myRessource ,array( 'time' => $time ,'utcTime' => $utcTime ) ); } } ?>