Login form witout mysql, changepassword in db.txt plz help me : Hay,
i have update password any users...but not working my code, plz see


    function change_pass($user_accounts_file, $username, $oldpass, $newpass) {
    	if(false === file_exists($user_accounts_file)) {
    		trigger_error(
    			sprintf(
    				'Акаунта $user_accounts_file не съществува на определеното местоположение: %s ',
    				$user_accounts_file
    			),
    			E_USER_ERROR
    		);
    		return false;
    	}
    	foreach(file($user_accounts_file) as $entry) {
    		list($entry_key, $entry_username, $entry_password) = array_map('trim', explode('|', $entry));
    		if($entry_username === $username && $entry_password === $oldpass) { 
    	    	if ( $entry_username == $username ) {
    				$entry_key = $entry_key;
    				$entry_username = $username;
    				$new_password = $newpass;
    
    				return (bool)file_put_contents(
    					$user_accounts_file,
    					sprintf(
    						"%s|%s|%s\r\n",
    						$entry_key,
    						$entry_username,
    						$new_password
    					),
    					FILE_APPEND | LOCK_EX
    				);
    			} else {
    				return false;
    			}
    		}
    	}
    	return false;
    }

I think the problem is here. Saves a new user instead of updating his password

    return (bool)file_put_contents(
    					$user_accounts_file,
    					sprintf(
    						"%s|%s|%s\r\n",
    						$entry_key,
    						$entry_username,
    						$new_password
    					),
    					FILE_APPEND | LOCK_EX
    				);

db.txt structure
ea55e673b8189b3140a1b2dc67a0fe605ca0e605|admin|admin
xa55de673b81e05ca0e631123131231212312130|moderator|moderator

ea55e673b8189b3140a1b2dc67a0fe605ca0e605|admin|admin123

when changing it should look like this;

ea55e673b8189b3140a1b2dc67a0fe605ca0e605|admin|admin123
xa55de673b81e05ca0e631123131231212312130|moderator|moderator