WordPress site URL changed; how to fix it without database access?

See Changing The Site URL « WordPress Codex for recovery instructions on how to reset the URLs without database access, i.e. by editing either the wp-config.php file or the theme’s functions.php file with FTP:

1) by adding lines to wp-config.php (which can be left in place):

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

2) or the theme’s functions.php file (but remove these after reloading the site a few times, as they write to the database).

update_option('siteurl','http://example.com');
update_option('home','http://example.com');