hi i have a website which has a login page and ten stores the login username as a session. once they have logged in i need them to press a button which then will create a folder with there username on it which has been gotten from the session. the problem is i can't get the name to show as the folder name as the folder gets created. the code is below.
<?php
//Start the Session
session_start();
if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
echo "Welcome " . $username . "
";
echo "This is the Members Area
";
echo "<a href='logout.php'>Logout</a>";
}else{
//3.2 When the user visits the page first time, simple login form will be displayed.
}
?>
<?php
mkdir("$username");
?>
please help to name the folder which is created to be there username. i also would like if the folder is already there to be redirected to a different page to which the folder needs to be created.
</div>
Does the webserver user have access to write to the root directory? You should probably give a full path to a directory
//make sure the web server user (i.e. Apache) has write access
// to /var/www/users/ directory
mkdir("/var/www/users/$username");