isPassword()) return false; $hash = Helpers::hash_pw($password); //Test if the folder exist if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) { mkdir(Constants::CONST_PASSWORD_FOLDER, 0777, true); } //Record the hash $fp = fopen(Constants::CONST_PASSWORD_FOLDER."/".Constants::CONST_PASSWORD_FILE, 'w'); fwrite($fp, $hash); fclose($fp); return true; } function isPassword(){ if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) return false; if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/'.Constants::CONST_PASSWORD_FILE)) return false; return true; } }