note 68630 added to function.is-writable
| From: | haccelatemaildotcom at osu1 dot php dot net | Date: | Fri, 04 Aug 2006 00:51:43 +0000 |
| Subject: | note 68630 added to function.is-writable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115533@lists.php.net to get a copy of this message | ||
Ooooops, sorry! My mistake. is__writable should be:
<?php
function is__writable($path)
{
if ($path{strlen($path)-1}=='/') //Start function again with tmp file...
return is__writable($path.uniqid(mt_rand()).'.tmp');
elseif (ereg('.tmp', $path))
{ //Check tmp file for read/write capabilities
if (!($f = @fopen($path, 'w+')))
return false;
fclose($f);
unlink($path);
return true;
}
else //We have a path error.
return 0; // Or return error - invalid path...
}
?>
The original could've deleted a folder if the path was invalid to start with (no trailing
slash..) and the folder was writable to begin with...
----
Server IP: 66.163.161.117
Probable Submitter: 124.177.140.212
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.is-writable.php
Edit -- https://master.php.net/note/edit/68630
Del: integrated -- https://master.php.net/note/delete/68630/integrated
Del: useless -- https://master.php.net/note/delete/68630/useless
Del: bad code -- https://master.php.net/note/delete/68630/bad+code
Del: spam -- https://master.php.net/note/delete/68630/spam
Del: non-english -- https://master.php.net/note/delete/68630/non-english
Del: in docs -- https://master.php.net/note/delete/68630/in+docs
Del: other reasons-- https://master.php.net/note/delete/68630
Reject -- https://master.php.net/note/reject/68630
Search -- https://master.php.net/manage/user-notes.php