note 49888 added to function.mkdir
| From: | par dot sandgren at gmail dot com | Date: | Fri, 11 Feb 2005 08:29:14 +0000 |
| Subject: | note 49888 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84842@lists.php.net to get a copy of this message | ||
You might want to upload files into random named dir's, just to make it harder to guess the
link. But still have some ID to know whats in there.
<?php
$dirLength = rand(30, 40);
$projectID = $_POST['pid']; // ID from database perhaps?
$rndName = "";
for($i=0; $i<$dirLength; $i++)
{
$rnd = rand(1, 3);
if($rnd == 1)
$rndName = $rndName . chr(rand(97, 122));
else if($rnd == 2)
$rndName = $rndName . chr(rand(65, 90));
else
$rndName = $rndName . chr(rand(48, 57));
}
$dirName = $projectID . "-" . $rndName;
mkdir($dirname);
?>
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49888
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49888&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49888&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49888&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49888&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49888&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49888&report=yes
Search -- http://master.php.net/manage/user-notes.php