SleePyCode Forums

Special Site & Other Boards => PasteBin => Topic started by: SleePy on Jun 24, 2010, 12:26 AM

Title: Paste-1277339219:v:use_geshi-1:v:type-php
Post by: SleePy on Jun 24, 2010, 12:26 AM
<?php
// We just start, and we are already preparing to shutdown.
// !!! This file is called via php_admin_value auto_prepend_file
register_shutdown_function('sm_shutdown_function');

// The fun never ends.
function sm_shutdown_function()
{
   // Make a clean getaway.
   $contents = ob_get_contents();
   ob_clean();


   // Inject something and act like nothing happened.
   $contents = str_replace('*****', '*****', $contents);
   echo $contents;
   exit;
}

?>
Title: Paste-1277339280:v:use_geshi-1:v:type-php
Post by: SleePy on Jun 24, 2010, 12:28 AM
<?php
// We just start, and we are already preparing to shutdown.
// !!! This file is called via php_admin_value auto_prepend_file
register_shutdown_function('sm_shutdown_function');

// The fun never ends.
function sm_shutdown_function()
{
   // Make a clean getaway.
   $contents = ob_get_contents();
   ob_clean();

   // First we find out if we are going to be redirecting and fix that.
   $headers = headers_list();
   foreach ($headers as $key => $value)
   {
      if (strpos($value, 'Location:') === false)
         continue;

      header('Location:' . strtr($value, array(
         'mydomain.com' => 'foobar.test',
      )));
   }

   // Inject something and act like nothing happened.
   $contents = str_replace('mydomain.com', 'foobar.test', $contents);
   echo $contents;
   exit;
}

?>