Is using extract($_POST) insecure?

后端 未结 5 1479
半阙折子戏
半阙折子戏 2021-01-20 17:03

Is using extract($_POST) insecure? If yes then what can I do about this?

5条回答
  •  终归单人心
    2021-01-20 17:48

    Yes it is insecure. Any one can override your local variables (for example $password or $access_level).

    I recommend declaring and assigning your own local variables like this:

    $var1 = isset($_POST['field_1'])?$_POST['field_1']:null;
    $var2 = isset($_POST['field_2'])?$_POST['field_2']:null;
    $var3 = isset($_POST['field_3'])?$_POST['field_3']:null;
    

提交回复
热议问题