Hello quick question about mkdir

So heres what I would like to try to do.
When some one registers on my site i want to give them a personal folder where i can pull data back to the client with a var in flash.

So it sould work like this
on my host default folder for all users would be user.
then
user/username/
example
user/RobPuck/
user/Mancent/

[php]

<?php $username = $_POST['username']; $path = "users/".$username."/"; //TO DO Add a way where if username is in use fail. if( USERNAME IS OPEN DO IT) { mkdir($path, 0755); echo "It Worked"; } else { echo "It Failed"; } ?>

[/php]

How about this:
[php]<?php
$username = $_POST[‘username’];
$path = “users/”.$username."/";
//TO DO Add a way where if username is in use fail.
if(!is_dir($path))
{
mkdir($path, 0755);
echo “It Worked”;
}
else
{
echo “It Failed”;
}
?>[/php]

Thank you That makes sence. How ever When i check the folder on the dedicated server I see it has the folder users. when the user registers it should make a folder users/$username/

That way each user has a unique folder located on the dedicated server.

Example:

[php]<?php
$username = $_POST[‘username’];
$path = “users/”.$username."/";
if(!is_dir($path))
{
mkdir($path, 0755);//To do make sure the folder is created as a unique user folder
echo “It Worked There is now on the dedicated server a folder called http://wiistream.net/users/Mancent/]http://wiistream.net/users/Mancent/]http://wiistream.net/users/Mancent/”;
}
else
{
echo “It Failed”;
}
?>[/php]

it worked perfectly thank you guys for the help.

[php]

<?php include "connect.php"; $username = $_POST['username']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $youremail = $_POST['youremail']; $password = $_POST['password']; $sql = mysql_query("SELECT youremail FROM accounts WHERE youremail = '$youremail'"); $rows = mysql_num_rows($sql); //function sha1_password($firstname,$password){$firstname = strtoupper($firstname); $password = strtoupper($password); return //SHA1($firstname.':'.$password);} //$new_password = sha1_password($firstname,$password); if($rows > 0) { echo "&msgText=Registered Failed!\n"; return FALSE; } else { echo "&msgText=Successfully registered!\n"; //$wow_mangos = mysql_query("INSERT INTO account (firstname,sha_pass_hash,gmlevel,email,expansion) VALUES //('$firstname','$new_password','0','$email','0')") or die(mysql_error()); $launcher = mysql_query("INSERT INTO accounts (username,firstname,lastname,password,youremail) VALUES ('$username','$firstname','$lastname','$password','$youremail')") or die(mysql_error()); $path = "../users/".$username."/"; mkdir($path, 0755); return FALSE; } ?>

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service