as the title suggests, I need to view images and then erase them from the disk. I can export them from the db and have them displayed correctly, but then I stop: either I visualize them or I delete them. I can't do both.
at the end of page, Afer the php code i try this:
<script type="text/javascript">
document.addEventListener('readystatechange', event => {
if (event.target.readyState === "interactive") {
setTimeout(function(){
<?php
$tags = explode('|',$del);
foreach($tags as $key) {
exec ('rm -f '.$path.$key.'.gif');
}
?>
}, 7000);
}
});
</script>
in this javascript if i insert a message it displays it (e.g. hello world) after the full load of the page and after the interval. If I enter the php code it executes it immediately. Why?