1 Star 0 Fork 0

edwinfound/phpmyadmin47

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
url.php 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
edwinfound 提交于 2017-05-16 21:16 +08:00 . dev
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* URL redirector to avoid leaking Referer with some sensitive information.
*
* @package PhpMyAdmin
*/
use PMA\libraries\Sanitize;
use PMA\libraries\Response;
/**
* Gets core libraries and defines some variables
*/
define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php';
// Only output the http headers
$response = Response::getInstance();
$response->getHeader()->sendHttpHeaders();
$response->disable();
if (! PMA_isValid($_REQUEST['url'])
|| ! preg_match('/^https:\/\/[^\n\r]*$/', $_REQUEST['url'])
|| ! PMA_isAllowedDomain($_REQUEST['url'])
) {
PMA_sendHeaderLocation('./');
} else {
// JavaScript redirection is necessary. Because if header() is used
// then web browser sometimes does not change the HTTP_REFERER
// field and so with old URL as Referer, token also goes to
// external site.
echo "<script type='text/javascript'>
window.onload=function(){
window.location='" , Sanitize::escapeJsString($_REQUEST['url']) , "';
}
</script>";
// Display redirecting msg on screen.
// Do not display the value of $_REQUEST['url'] to avoid showing injected content
echo __('Taking you to the target site.');
}
die();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/edwinfound/phpmyadmin47.git
git@gitee.com:edwinfound/phpmyadmin47.git
edwinfound
phpmyadmin47
phpmyadmin47
master

搜索帮助