Jump to content

coolphpdude

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Everything posted by coolphpdude

  1. $dir = "/testfolder/test"; echo "$dir"; // $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 (false !== ($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true); } closedir($dh); if ($DeleteMe){ @rmdir($dir); } } got that now? still doesnt work
  2. $dir = "/testfolder/test/"; echo "$dir"; // $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 (false !== ($obj = readdir($dh))) { if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true); } closedir($dh); if ($DeleteMe){ @rmdir($dir); } } SureRemoveDir('EmptyMe', false); SureRemoveDir('RemoveMe', true); is that right? I think the permissions are all set, theres no errors coming up about permission denied.
  3. hmmm, nope, its not giving me an error or anything but its not deleting the contents of my folder either... any ideas? i've obviously set the $dir variable
  4. i'll give that a try, two mins
  5. Hello there, I've been trying to delete a folder for a particular user. I found that you can't delete the folder unless it is empty. So i have been trying to look for ways to loop through deleting the content then removing the folder. so far i've got the following... (and it doesnt work so im stuck!) function deltree( $f ){ if( is_dir( $f ) ){ foreach( scandir( $f ) as $item ){ if( !strcmp( $item, '.' ) || !strcmp( $item, '..' ) ) continue; deltree( $f . "/" . $item ); } rmdir( $f ); } else{ unlink( $f ); } }
  6. sorry, thought it might have been a php issue as this hasn't happened on pages that dont have php.
  7. This has got me stumped. I hav a dark blue page background with a light blue layer on top of it. I am using tables and forms within this light blue layer. However, the age background is showing through wherever I have got a table or form. Any ideas?
  8. Sorted cheers!!
  9. thanks, i'll go through this tomorrow. Sounds exactly what i need though so cheers for that!
  10. Hey there, I think this is a nice easy one for any experienced people out there. My site allows a student to register as a user. Have a problem with users putting a space after choosing their username, for example a new user registers and chooses 'new' as the username but they put a space after it so it actually appears as 'new '. how do i format the username they choose so that any whitespace AFTER the username, is removed?? Cheers
  11. thanks alot! that works a treat!!!
  12. hi there, I need help with formatting a search query. I have a database of memo's for a user, each memo has an expiry date, i only want to display the memo's to the user that have not yet expired. so for example I have a memo that is no use past the 20th of june so i set the expirary date in the database to 2008-06-20. This memo will be shown until and including the the 20th of june. Come the 21st of June that memo will no longer be displayed. how do i include that in my search query??? so far ive got this, $memo_result = mysql_query("SELECT * FROM memos WHERE username='$user'", $db); This works and all memos are displayed but i need to add something along the lines of:- $memo_result = mysql_query("SELECT * FROM memos WHERE username='$user' AND curdate <= 'expirary_date'", $db); Can anyone help?
  13. that works, im now seeing the tick box, however its not deleteing. I'll have a play about with it when i get back. Cheers for your help, much appreciated!
  14. echo "<br>"; echo '<form method="post" action='''.$_SERVER['PHP_SELF'].'?action=delete">'; echo "<table width='100%' border='2' bordercolor='#cccccc' style='border-collapse: collapse' cellpadding='5' align=center >\n"; they are line 170-173
  15. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\Inetpub\vhosts\thesellerswarehouse.co.uk\httpdocs\mymessages.php on line 172 i get that error
  16. echo "<form method='post' action=''.$_SERVER['PHP_SELF'].'?action=delete'>'."; Can someone help me sort out the " and ' on this please?
  17. cheers i'll try it
  18. echo "<table>\n"; echo "<tr><th>Message ID</th><th>Subject</th><th>Delete</th></tr>\n"; while ($rows = mysql_fetch_array($messages)) { printf("<tr><td align='center' width='100'><font face='arial'><font color='#648CC8'>%s</font></td>\n", $row["id"]); printf("<td>%s</td>\n", $row["subject"]); printf("<td align='center' cellpadding='10' width='60'><input class='blank' name='checkbox[]' type='checkbox' id='checkbox[]' value='".$row['recordID']." '></td></tr>"); } } echo "</table>\n"; and now im not sure where to put the delete or what to set
  19. Bump! Ive put the checkbox in for every message output in my while loop. I don't quite understand what the lad above is saying (although i do really appreciate your help). Im not sure what i shoudl be setting as the attributes on his line of code or what to do to create the delete button/link that wil delete the selected messages. Can anyone help??
  20. cheers i'll give it a go now!
  21. So would i put a delete button at the top hyperlinked to say delete.php and in that script include... switch(@$_GET["action"]) { case "delete"; <?php if(is_array($_POST['checkbox'])){ foreach($_POST['checkbox'] as $'recordID'){ mysql_query("Delete From tblNAME WHERE ID='".$'recordID'."'") or die(mysql_error()); } } break; ...is that right?
  22. i cant quite understand that, could you explain it?
  23. Hi there, i think this will be an easy one for you lot but i just can't seem to get my head around it. I got a message database on my project. So a user receives messages from other user's just like an email system. Currently i have a delete button next to each message as it is output from the database using a while loop. Now the propblem with this is, if you have got 40 messages you have to click delete 40 times. I want it so that theres a tick box next to each message so u can mark the messages you would like to delete and click a single delete button at the top to delete all of the marked messages. Is this easy? most email messaging systems have it so i suppose its do able, i just dont know how. Also could i place a tick box at the so the user could click this and it would mark all messages on this page?? Cheers
  24. cheers i'll give it ago. thanks again mate
  25. that sounds like exactly what i am after. Does the table delete itself after use? Would it slow down my database if 700 users were viewing it and it had to create a temporary table for every user viewing that page??
×
×
  • 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.