php security for location header injection via $_GET

后端 未结 4 1972
有刺的猬
有刺的猬 2021-01-20 15:24

I\'ve got this code on my page:

header(\"Location: $page\");

$page is passed to the script as a GET variable, do I need any security? (if so what)

<
4条回答
  •  无人及你
    2021-01-20 15:55

    Or, at the very least, define a whitelist of allowed URLs, and only forward the user if the URL they supplied is in the GET variable is in the list.

提交回复
热议问题