If you have locked yourself out, visit http://example.com/?q=user just like you do to re-enable offline sites. You can log in there, enough to become admin, although none of the navigation will work yet.
Next, enter http://example.com/?q=admin/settings/clean-urls (in DRUPAL 5 and 6) or http://example.com/?q=admin/config/search/clean-urls (in DRUPAL 7) to view the page where you can unset clean URLs. Your interface will be usable again.