【问题标题】:TYPO3 userFunc give GET Parameter to php fileTYPO3 userFunc 将 GET 参数提供给 php 文件
【发布时间】:2017-04-07 11:00:09
【问题描述】:

我通过 userFunc 包含一个 php 文件,并希望提供 get 参数“?session_start=1”并在函数中使用它。

TS:

includeLibs.voucher = fileadmin/php/shop_init.php
lib.phpscript = USER
lib.phpscript.userFunc = voucher->init
lib.phpscript.session_start_var = GP:session_start

php 文件

<?php
class voucher {
 public function init($content ="", $conf){

$session_start = $conf['session_start_var']?t3lib_div::_GP($conf['session_start_var']):false;



$lang_id = ($GLOBALS['TSFE']->sys_language_uid == 0 ? "&lang=de" : "&lang=en");
 if($_GET["session_start"] == "" && $_GET["tx"] == "" && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')){

  if($_GET["type"] == 1)
    die(header("Location:http://xx.pro/post?shop=1&s=1&referer=http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]$lang_id"));
  elseif($_GET["type"] == 2)
    die(header("Location:http://xx.pro/post?shop=2&s=1$lang_id"));
  elseif($_GET["type"] == 3)
    die(header("Location:http://xx.pro/post?shop=3&s=1$lang_id"));
  else
    die(header("Location:http://xx.pro/post?s=1$lang_id"));

}  

 return "<iframe id='frame-one' scrolling='no' frameborder='0'  style='".($_GET["type"] == "" ? "height:1640px;" : "height:1640px;")." width:100%;' src='http://xx.pro/post/index.php?view=".$_GET["view"]."&tx=".$_GET["tx"]."&st=".$_GET["st"]."&amt=".$_GET["amt"]."&type=".$_GET["type"]."$lang_id' ></iframe>";
 }
}
?>

当我回显 $session_start 时,输出 = GP:session_start 而不是 1

提前谢谢

【问题讨论】:

  • 所以,又是你。而且您仍在尝试通过一些环回孔将 php 代码 bash 到 TYPO3 中,这是一种早就应该被删除的史前技术。无论所有缓存和 TYPO 为您提供的任何安全措施如何,都用双脚将其踩在那里。这个实际的纯代码可用于跨站点脚本攻击。只需学习如何编写一个实际的扩展,这并不难。你到底在那儿做什么。捕获所有请求并重定向它们,其中一些基于语言?老兄。 TYPO3 内置多语言功能。

标签: php parameters typo3 typoscript


【解决方案1】:

我认为你分配的 GP 错了,试试这样:

includeLibs.voucher = fileadmin/php/shop_init.php
lib.phpscript = USER
lib.phpscript.userFunc = voucher->init
lib.phpscript.userFunc.session_start_var = TEXT
lib.phpscript.userFunc.session_start_var.data = GP:session_start

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 2016-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多