1 ){ /* (1) Decrement the depth */ $depth--; /* (2) Try to override the secret file */ if( @file_put_contents(SECRET_CONF, "$key:$depth") ){ slog("Secret depth decremented to $depth", 'cyclic-hash:decr'); return 0; }else{ slog("Error while decrementing secret depth", 'cyclic-hash:decr'); return 127; } /* [4] If cannot decrement, generate new password =========================================================*/ }else{ // Generate new secret $secret = generate_secret().':999'; // Try to override the secret file if( @file_put_contents(SECRET_CONF, $secret) ){ slog("Random secret generated successfully", 'cyclic-hash:decr'); return 0; }else{ slog("Error while generating new random secret", 'cyclic-hash:decr'); return 127; } } return 0; } echo cyclichash_decr(); ?>