I am saving search data on website to text file on my disk.
I want to know if it is safe to do that. What if some virus script is saved into the file? is it harmful?
This is the code that I am using to save form data to text file:
if(isset($_GET ['search'])) {
$data = $_GET ['search'];
$date = date("d/m/y : H:i:s : ");
$ret = file_put_contents('mydata.txt', $date.$data.PHP_EOL, FILE_APPEND | LOCK_EX);
}