How to make a form resize error to prevent the file from being edited or overwritten if the file already exists?
I'm not sure how to edit this code to readjust the error to prevent the file from being edited or overwritten if the file already exists.
Currently, when $name already exists, your code will use the renamed target file name to save the data, just change this part so that it displays an error and ends execution with exit();
On the other hand, why does your code echo "published successfully" in the else block? You should tell the user that not all required data was entered and ask him/her to resubmit.
By the way, you allow the user to enter something and then save it as xxxx.php, which could be aserious security threat! ! !Please think again if you want to do it (or not)
For the above (1) and (2), please modify the code to: