Auth as first admin

Public

Auth as first admin if no ssh no Drush no money no honey...

Get raw version
php
  1. <?php
  2. define('DRUPAL_ROOT', getcwd());
  3.  
  4. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  5. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  6.  
  7. $user = user_load(1);
  8.  
  9. if ($user) {
  10. $edit = (array)$user;
  11. list($major_version, ) = explode('.', VERSION);
  12. if ($major_version == '6') {
  13. user_authenticate_finalize($edit);
  14. }
  15. elseif ($major_version == '7') {
  16. user_login_finalize($edit);
  17. }
  18.  
  19. drupal_set_message("Don't forget to delete " . __FILE__, 'warning');
  20. drupal_goto();
  21. }
  22. else {
  23. echo '<h2>Error.</h2>';
  24. }