BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

database_key.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare(strict_types=1);
  3. $ENV = ENV::go();
  4. // if set, do not enforce login so we can set the encryption key w/o an account
  5. if (!$ENV->FEATURE_SET_ENC_KEY_PUBLIC) {
  6. if (!check_perms('site_debug')) {
  7. error(403);
  8. }
  9. }
  10. if (isset($_POST['dbkey'])) {
  11. // if set, do not enforce login so we can set the encryption key w/o an account
  12. if (!$ENV->FEATURE_SET_ENC_KEY_PUBLIC) {
  13. authorize();
  14. }
  15. apcu_store('DBKEY', hash('sha512', $_POST['dbkey']));
  16. }
  17. View::show_header('Database Encryption Key'); ?>
  18. <!-- Start HTML -->
  19. <h2 class="header">
  20. Database Encryption Key
  21. </h2>
  22. <div class="box pad slight_margin">
  23. <h4>
  24. There is
  25. <?=((apcu_exists('DBKEY') && apcu_fetch('DBKEY'))?"already a":"NO")?>
  26. key loaded
  27. </h4>
  28. <form class="create_form" name="db_key" action="" method="post">
  29. <input type="hidden" name="action" value="database_key" />
  30. <input type="hidden" name="auth"
  31. value="<?=$LoggedUser['AuthKey']?>" />
  32. <div style="display: flex;">
  33. <input type="text" name="dbkey" style="flex-grow: 1;" />
  34. <input type="submit" name="submit" class="button-primary" value="Update key" />
  35. </div>
  36. </form>
  37. </div>
  38. <?php View::show_footer();