Viewing Paste 443

Formated Paste

  1. <?php
  2. // We just start, and we are already preparing to shutdown.
  3. // !!! This file is called via php_admin_value auto_prepend_file
  4. register_shutdown_function('sm_shutdown_function');
  5.  
  6. // The fun never ends.
  7. function sm_shutdown_function()
  8. {
  9. // Make a clean getaway.
  10. $contents = ob_get_contents();
  11.  
  12. // First we find out if we are going to be redirecting and fix that.
  13. $headers = headers_list();
  14. foreach ($headers as $key => $value)
  15. {
  16. if (strpos($value, 'Location:') === false)
  17. continue;
  18.  
  19. header('Location:' . strtr($value, array(
  20. 'mydomain.com' => 'foobar.test',
  21. )));
  22. }
  23.  
  24. // Inject something and act like nothing happened.
  25. $contents = str_replace('mydomain.com', 'foobar.test', $contents);
  26. echo $contents;
  27. }
  28.  
  29. ?>
  30.  
Name:
Email:
Code/text to paste:
  • Enable code highlighting
  • Code Language:
  • A duck, cat and a goose walk into a bar. How many animals walked into a bar?:
Highslide for Wordpress Plugin