I have a code that will prompt if i want to delete files in the directory. The problem arises when the page refreshes, it will just delete the files without the prompt selection. I want to not delete the files even when the page refresh.
<script language="javascript">
function checkMe() {
if (confirm("Are you sure")) {
alert("Clicked Ok");
<?php
$files = glob('d:/pics/*'); // get all file names
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete file
}
?>
return true;
} else {
alert("Clicked Cancel");
return false;
}
}
</script>
Here's the code for calling the function
<a href='index.php?main=add-doc' class='footer-img' onclick=\"return checkMe();\"><div class='record'><img src='images/download.png' style='position: relative; margin: auto;'/>Upload Record</div></a>