I want to delete a file when a user clicks on a delete link. But when I go to my page, the file gets deleted and I don’t know why:
echo '<h3><a onclick="'.unlink(__FILE__).'">Delete Now!</a></h3>';
What am I doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This code will delete the current file when the user clicks the link:
If you prefer to use POST instead of GET method, use this code: