...

View Full Version : Delete running file



Birdie312
09-23-2006, 08:11 PM
Hi, i have a php page.

Is it possible to delete the file itself whilst its running?

For eg..



unlink("thispage.php");


Doesnt work for me. Thanks.

Mwnciau
09-23-2006, 08:50 PM
You could create a new file:


$file = 'deletefile' . rand(0, 999) . 'php';
while (file_exists($file)){
$file = 'deletefile' . rand(0, 999) . 'php';
}
$fh = fopen($file, 'a+');
fwrite($fh, '<?php unlink("' . $_SERVER['PHP_SELF'] . '"); ?>');
header('Location: ' . $file);

Birdie312
09-23-2006, 10:19 PM
oh nice idea! Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum