diff --git a/lib/mfrc522/source/loop.php b/lib/mfrc522/source/loop.php index 521d99f..d7fa994 100755 --- a/lib/mfrc522/source/loop.php +++ b/lib/mfrc522/source/loop.php @@ -111,6 +111,7 @@ global $f_accesslog; /* (5) Update global state */ + global $f_gstate; $state = get_gstate(); // manage error @@ -210,7 +211,8 @@ /* (2) Update the state file */ - $written = @file_put_contents(STATE_CONF, $state); + $f_gstate->seek(0); + $written = $f_gstate->fwrite($state); /* (3) Manage error */ if( $written === false ) @@ -261,7 +263,7 @@ /* (1) Read accesses */ $f_auth = new SplFileObject(AUTH_CONF, 'r'); $f_actions = new SplFileObject(ACTIONS_CONF, 'r'); - $f_gstate = new SplFileObject(STATE_CONF, 'r'); + $f_gstate = new SplFileObject(STATE_CONF, 'w'); /* (2) Append accesses (logs) */ $f_accesslog = new SplFileObject(DEFAULT_DATA, 'a');