
December 14th, 2003
01:26 PM
Baton-twirling in the parade of color.
Status: Offline!
Registration With Folder Copy
Hmm.. it might seem a bit naive of me, but does anyone know of a script that's out there that will allow users to register, and then once they're registered, automatically create them a "home" directory with predefinied initial contents?
As in...
When a user registers, a folder containing an image upload script is copied to their "home" folder, and they, on their user page, are transferred to that script for image uploads....
It seems almost like a combination of three scripts... I already have the image upload one written.
___________________




December 18th, 2003
01:26 PM
use the mkdir(); function.. something like
<?php
mkdir ("/$username", 0777);
?>
and then use fwrite() to create the file
___________________


March 17th, 2004
05:51 PM
Neverside Newbie
Status: Offline!
I just searched and came up with this thread, expanding on the above, how would you limit the users to a certain amount of space. For example, say I wanted to limit each new folder to 1mb. 

March 19th, 2004
09:58 AM
Pawn Coder
Status: Offline!
Well, where is it?
___________________
- Moderator at the official AMX Mod X forums

March 20th, 2004
06:58 AM
Neverside Newbie
Status: Offline!
Well before your script actually goes through with the users' request, if the request will take up space, then run a check for how much the user has used:
<?php
$dir = "."; //Change of course
$dp = opendir($dir);
while($file = readdir($dp))
{
if($file != "." && $file != "..")
{
$folderuse = $folderuse + filesize($file);
}
}
closedir($dp);
if($folderuse >= 1000000) //Remember....this is always in BYTES!
{
//Sorry! Over 1 meg!
}
else
{
//Go on...
}
?>
The script there has a problem though....it doesn't check whether the action the user is about to take could go over 1 meg. If it's an upload, just do something like:
$folderuse = $folderuse + $_FILES['file']['filesize']
And run the check.