darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 it will only delete the images but you must put false in the sureremovedir function as well. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339257 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339260 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 blank XD Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339261 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 go back to the other function it was helpful and we need to use PHP function unlink to delete files. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339264 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 try this <?php $file = "test.txt"; if (!unlink($file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339265 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 got an error this time Wait, gimme a sec. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339268 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 $file = ($f_user"/test.txt"); caused a blank screen. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339269 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 the directory is $f_user right? why do u need a txt file? Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339271 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 $file= $_GET[del]; $directory="path here"; Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339276 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 you put a .txt in your code o_O Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339282 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 still blank Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339284 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 $file = $_GET[del]; $directory=f_user; if (!unlink($directory'/'$file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?> $directory wasn't being used, so I defined it. Although I guess that didn't help. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339295 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 whats the issue now? Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339297 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 error still Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339298 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 error deleting file? Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339299 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 yeah. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339303 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 thats because you told it if directory and file not true "error" Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339304 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 oops if delete dir and file not true then error Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339306 Share on other sites More sharing options...
Timma Posted September 1, 2007 Share Posted September 1, 2007 Maybe the directory should be more than just f_user? Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339307 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 <?php $file = $_GET[del]; $directory=f_user; if (!unlink($directory/$file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?> How do I make file true but not dir? And no, it is just f_user Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339310 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 <?php $file = $_GET[del]; $directory=f_user; if (!unlink($file)) { echo ("Error deleting $file"); } else { echo ("Deleted $file"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339312 Share on other sites More sharing options...
LemonInflux Posted September 1, 2007 Author Share Posted September 1, 2007 error. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339317 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 im not sure how you would do thi but you need to get it so it links it to the directory so it can delete the images in there. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339320 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 Author's Note: if you have a file opened with fopen(), you need to fclose() it before you call unlink() Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339321 Share on other sites More sharing options...
hostfreak Posted September 1, 2007 Share Posted September 1, 2007 Umm.. $directory = 'f_user'; //Maybe? Edit: Just taking a stab at it, really don't feel like reading through 5 pages to figure out the current state of your problem. Quote Link to comment https://forums.phpfreaks.com/topic/67496-_get-from-a-url/page/3/#findComment-339325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.