2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * URL redirector to avoid leaking Referer with some sensitive information.
8 declare(strict_types
=1);
11 use PhpMyAdmin\Sanitize
;
12 use PhpMyAdmin\Response
;
14 if (! defined('ROOT_PATH')) {
15 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
19 * Gets core libraries and defines some variables
21 define('PMA_MINIMUM_COMMON', true);
22 require_once ROOT_PATH
. 'libraries/common.inc.php';
24 // Only output the http headers
25 $response = Response
::getInstance();
26 $response->getHeader()->sendHttpHeaders();
29 if (! Core
::isValid($_GET['url'])
30 ||
! preg_match('/^https:\/\/[^\n\r]*$/', $_GET['url'])
31 ||
! Core
::isAllowedDomain($_GET['url'])
33 Core
::sendHeaderLocation('./');
35 // JavaScript redirection is necessary. Because if header() is used
36 // then web browser sometimes does not change the HTTP_REFERER
37 // field and so with old URL as Referer, token also goes to
39 echo "<script type='text/javascript'>
40 window.onload=function(){
41 window.location='" , Sanitize
::escapeJsString($_GET['url']) , "';
44 // Display redirecting msg on screen.
45 // Do not display the value of $_GET['url'] to avoid showing injected content
46 echo __('Taking you to the target site.');