note 24294 deleted from function.unlink by maxim
| From: | maxim@php.net | Date: | Mon, 12 Aug 2002 19:20:55 +0000 |
| Subject: | note 24294 deleted from function.unlink by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34886@lists.php.net to get a copy of this message | ||
Regarding this function:
<?php
function suppr($file) {
$delete = @unlink($file);
if (@file_exists($file)) {
$filesys = eregi_replace("/","\\",$file);
$delete = @system("del $filesys");
if (@file_exists($file)) {
$delete = @chmod ($file, 0775);
$delete = @unlink($file);
$delete = @system("del $filesys");}}}
?>
You need to use clearstatcache or the file will be reported as present after it is deleted
<?php
function suppr($file) {
$delete = @unlink($file);
clearstatcache ();
if (@file_exists($file)) {
$filesys = eregi_replace("/","\\",$file);
$delete = @system("del $filesys");
clearstatcache ();
if (@file_exists($file)) {
$delete = @chmod ($file, 0775);
$delete = @unlink($file);
$delete = @system("del $filesys");}}}
?>