ttl.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once 'includes/common.inc.php';
  3. if (isset($_POST['key'], $_POST['ttl'])) {
  4. if ($_POST['ttl'] == -1) {
  5. $redis->persist($_POST['key']);
  6. } else {
  7. $redis->expire($_POST['key'], $_POST['ttl']);
  8. }
  9. header('Location: view.php?key='.urlencode($_POST['key']));
  10. die;
  11. }
  12. $page['css'][] = 'frame';
  13. $page['js'][] = 'frame';
  14. require 'includes/header.inc.php';
  15. ?>
  16. <h2>Edit TTL</h2>
  17. <form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
  18. <p>
  19. <label for="key">Key:</label>
  20. <input type="text" name="key" id="key" size="30" <?php echo isset($_GET['key']) ? 'value="'.format_html($_GET['key']).'"' : ''?>>
  21. </p>
  22. <p>
  23. <label for="ttl"><abbr title="Time To Live">TTL</abbr>:</label>
  24. <input type="text" name="ttl" id="ttl" size="30" <?php echo isset($_GET['ttl']) ? 'value="'.format_html($_GET['ttl']).'"' : ''?>> <span class="info">(-1 to remove the TTL)</span>
  25. </p>
  26. <p>
  27. <input type="submit" class="button" value="Edit TTL">
  28. </p>
  29. </form>
  30. <?php
  31. require 'includes/footer.inc.php';
  32. ?>