Jump to content

Mkdir Not Working?


localhost

Recommended Posts

[code]$query = "INSERT INTO users (`username`, `email`, `password`, `joindate`, `ipaddress`, `auth`, `dir`) VALUES ('$username', '$email', '$enc_password', '$joindate', '$ipaddress', '$auth', '$num')";
$result = mysql_query($query) or die('Could not insert user details into database.');

}
}

if($result) {

$queryS = "SELECT * FROM users";
$resultS = mysql_query($queryS) or die(mysql_error());

$fetch = mysql_fetch_array($resultS) or die(mysql_error());
$userdir = $fetch['dir'];

/* NOTE, BACKSLASHES MUST BE USED WITH WINDOWS, IF ON LINUX OR UNIX SERVER REPLACE \ WITH /'S IN THE NEXT LINE */
mkdir("files\$userdir\$username", 0777);
}[/code]

i made it so a random code is generated numbers only, is then inserted into the database under that users row, i am trying to make it so upon registration it takes that 6 digit code and makes the folder under files\.
it is not working, although the 6 digit random number does get generated and inserted into the db.
Link to comment
Share on other sites

With windows use two \\ like so:
[i]mkdir("files\\$userdir\\$username", 0777);[/i]
Currently PHP is escaping the $ sign on your variables so it creating folder called 'files$userdir$username' it is not parsing the variables. Now with the double backslahes PHP will not escape the $ sign.

Also chnaging the CHMOD settings to 0777 is completly usedless on Windows as it doesnt use CHMOD.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.