Scenario:
You need to update some configuration but you dont have 
username and password, 
no access in the database as well, 
Drush is not an option as well, 
MTA (mail) is not installed in the server, 
BUT you have access to the code.
Luckily there is a trick to gain an access with the above restrictions. In the code particularly in template.php of active theme just put the below command and refresh the page.
NOTE: You may need to refresh several times to see the admin menu.
global $user;
$user = user_load(1);
WARNING: Don't do this in production as you are going to grant all visitors an administrator access.