| | |
why isnt this working?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 281
Reputation:
Solved Threads: 2
PHP Syntax (Toggle Plain Text)
<?php $documentroot = $_SERVER['DOCUMENT_ROOT']; $username = "Administrator"; $dir = $documentroot . '/' . $username; function rmdir_r ( $dir, $DeleteMe = TRUE ) { if ( ! $dh = @opendir ( $dir ) ) return; while ( false !== ( $obj = readdir ( $dh ) ) ) { if ( $obj == '.' || $obj == '..') continue; if ( ! @unlink ( $dir . '/' . $obj ) ) rmdir_r ( $dir . '/' . $obj, true ); } closedir ( $dh ); if ( $DeleteMe ) { @rmdir ( $dir ); } } ?>
it supposed to delete all files int eh directory and delete tehd riectory but its not doing anything!!!!!!
1
#2 Oct 24th, 2009
Try adding the following line to your script, anywhere after the line
Basically, the code inside the function doesn't execute until the function is called.
$dir = $documentroot . '/' . $username; but not inside the function: php Syntax (Toggle Plain Text)
rmdir_r($dir);
Last edited by darkagn; Oct 24th, 2009 at 9:43 am.
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend. ![]() |
Similar Threads
- VERY complicated IF statement isnt working! :O( (PHP)
- My IF ($email_settings == "0") isnt working! :( (PHP)
- why isnt it working!?! (C++)
- my html code isnt working please help (JavaScript / DHTML / AJAX)
- msn messenger 7.0 isnt working (Windows 95 / 98 / Me)
- Sound Card isnt working! (PCI and Add-In Cards)
- HELP -my Date code isnt working (ASP)
- CD-ROm isnt working correctly (Storage)
Other Threads in the PHP Forum
- Previous Thread: Automatically create pages from files in directory
- Next Thread: block js injections through php
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





