Advertisement
Guest User

Untitled

a guest
Feb 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. define('DRUPAL_ROOT', getcwd() . "/..");
  2.  
  3. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  4. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  5.  
  6. $username = "Silox";
  7. $password = "hidden";
  8.  
  9. global $user;
  10.  
  11. $account = user_authenticate($username, $password);
  12.  
  13. // Woah, it seems like we don't know this user, let's create him!
  14. if (!$account) {
  15. $userinfo = array(
  16. 'name' => $username,
  17. 'pass' => $password,
  18. 'init' => $username,
  19. 'status' => 1,
  20. 'access' => REQUEST_TIME,
  21. );
  22. $account = user_save(drupal_anonymous_user(), $userinfo);
  23. $account = user_authenticate($username, $password);
  24. }
  25.  
  26. $user = user_load($account, TRUE);
  27. drupal_session_regenerate();
  28. ?>
  29.  
  30. <?php
  31. chdir('../');
  32. require_once './includes/bootstrap.inc';
  33. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement