Reputation: 9
I've got a php code:
if (isset($_POST['submit'])) {
$name = $_POST['gname'];
$description = $_POST['gdescription'];
mkdir ("upload/$name", 0777);
}
which works perfectly fine however is there a way to password protect the new directory when the form creates it and the password itself is defined by the user via one of the fields in the form?
Upvotes: 0
Views: 115
Reputation: 33542
There is a chown() function in PHP which will set the owner of the folder to a specific user, but that user needs to be defined on the server running the system.
The better approach would be to simply do the ownership via the page itself to ensure that only the right owner can access the files inside it.
Upvotes: 1