signon-script.php 796 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Single signon for phpMyAdmin
  4. *
  5. * This is just example how to use script based single signon with
  6. * phpMyAdmin, it is not intended to be perfect code and look, only
  7. * shows how you can integrate this functionality in your application.
  8. */
  9. declare(strict_types=1);
  10. // phpcs:disable Squiz.Functions.GlobalFunction
  11. /**
  12. * This function returns username and password.
  13. *
  14. * It can optionally use configured username as parameter.
  15. *
  16. * @param string $user User name
  17. *
  18. * @return array
  19. */
  20. function get_login_credentials($user)
  21. {
  22. /* Optionally we can use passed username */
  23. if (! empty($user)) {
  24. return [
  25. $user,
  26. 'password',
  27. ];
  28. }
  29. /* Here we would retrieve the credentials */
  30. return [
  31. 'root',
  32. '',
  33. ];
  34. }