Jump to content

darkfreaks

Members
  • Posts

    4,953
  • Joined

  • Last visited

Everything posted by darkfreaks

  1. try this <?php $file = "test.txt"; if (!unlink($file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?>
  2. go back to the other function it was helpful and we need to use PHP function unlink to delete files.
  3. try: <?php $dir = the target directory $DeleteMe = false; function SureRemoveDir($dir, $DeleteMe) { if(!$dh = @opendir($dir)) return; while (($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, false); } if ($DeleteMe){ closedir($dh); @rmdir($dir); } } //SureRemoveDir('EmptyMe', false); //SureRemoveDir('RemoveMe', true); ?>
  4. it will only delete the images but you must put false in the sureremovedir function as well.
  5. if it returns true it will delete everything including the folder if false it will just delete all images.
  6. <?php $dir = the target directory $DeleteMe = if true delete also $dir, if false leave it alone function SureRemoveDir($dir, $DeleteMe) { if(!$dh = @opendir($dir)) return; while (($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true); } if ($DeleteMe){ closedir($dh); @rmdir($dir); } } //SureRemoveDir('EmptyMe', false); //SureRemoveDir('RemoveMe', true); ?>
  7. the functions claims to get rid of everything inside the folder and the folder itself
  8. ah screw it try this instead see if it works any better: <?php function full_rmdir($dirname) { if ($dirHandle = opendir($dirname)) { $old_cwd = getcwd(); chdir($dirname); while ($file = readdir($dirHandle)) { if ($file == '.' || $file == '..') continue; if (is_dir($file)) { if (!rmdir_rf($file)) return false; } else { if (!unlink($file)) return false; } } closedir($dirHandle); chdir($old_cwd); if (!rmdir($dirname)) return false; return true; } else { return false; } } ?>
  9. it doesnt delete anything it just says deleting file.jpg but it doesnt?
  10. which file?
  11. alright ill be right here :-\
  12. cool glad i was able to help man < /feels useful >
  13. you put the directory and file define at the top of the code? paste the code
  14. hope it works
  15. the code i just posted above i left out the path code to specify the directory :-\
  16. oops try adding $dir = "/path/to/base/dir"; appearantly i left that line out so it wouldnt read the directory path and wouldnt do anything.
  17. weird so it didnt work at all?
  18. not sure if thi will help but i got this from php.net when i looked up opendir delete <?php recursive_delete($dir); function recursive_delete( $dir ) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false ) { if( $file != "." && $file != ".." ) { if( is_dir( $dir . $file ) ) { echo "Entering Directory: $dir$file<br/>"; recursive_delete( $dir . $file . "/" ); echo "Removing Directory: $dir$file<br/><br/>"; rmdir( $dir . $file ); } else { echo "Deleting file: $dir$file<br/>"; unlink( $dir . $file ); } } } closedir($dh); } } } ?>
  19. <?php if (!isset($_GET['del'])){ echo "Could not Delete the file!"; } else { $file = $_GET['del']; } ?>
  20. <?php (!isset($_GET['del'])){ echo "Could not Delete the file!"; } else { $file = $_GET['del']; } ?>
  21. <?php $query = mysql_query("SELECT * FROM details WHERE $metode LIKE '%$search%' LIMIT 0, 50 ORDER BY 'level' "); ?>
  22. oops sorry my keyboard is being weird anyway i was trying to say do a mysql_query to select the delete field and grab it that way.
  23. ty doing a query and selecting it that way?
  24. please list the errors so we know what to look for?
  25. did you try replacing $_GET with $_REQUEST ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.