Hello everyone, there was such a question, there is a script that puts the data in the file after each image to it, the data mainly consist of a form. The question is whether it is possible, somehow besides str_replace remove a form from the contents of a file, if this form is not one but there are several more.

 <form method="POST" action="creator.php"> <div class="inpt"> Tour Text </div> <div class="inp"> <input type="text" name="content36" size="40" value="<?php $cfile = 'content/content36.txt';$cont = file_get_contents($cfile); echo $cont;?>" style="text-align:center;"> </div> <div class="inpt"> Tour Text </div> <div class="inp"> <textarea name="content37" rows="30" cols="100" style="resize:none;"> <?php $cfile='content/content37.txt' ;$cont=f ile_get_contents($cfile); echo $cont; ?> </textarea> </div> <div class="inp"> <input type="submit" value="Change Content"> </div> 

It is necessary to remove such forms without replacing others, is there a way other than str_replace ?

  • 2
    There is generally no write this form in the file - Naumov
  • Thanks, your answer helped a lot to solve the problem - hovdev
  • You want to selectively delete data, but data can be duplicated and no different. Therefore, you need to make it so that the data become unique. As an option, add the sign "time" and analyze it for any conditions. - Vadim Bondarenko
  • Thanks a lot, I solved the issue by creating a separate file for each form, it is easier and more convenient for editing - hovdev

0