写入文件在PHP中被认为是危险的吗?

时间:2018-04-25 15:34:49

标签: php web-services

说我有这个PHP文件:

<?php
$file = 'prism.csv';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= $_POST['user'];
$current .= ";";
$current .= $_POST['score0'];
$current .= ";";
$current .= $_POST['score1'];
$current .= ";";
$current .= $_POST['score2'];
$current .= ";";
$current .= $_POST['score3'];
$current .= "\n";
// Write the contents back to the file
file_put_contents($file, $current);
?>

写入这样的文件是危险的,如何在攻击的情况下利用它?我的朋友说这是,但他不能给我一个例子。如何保护此文件?

0 个答案:

没有答案