Jump to content


Photo

Mkdir Not Working?


  • Please log in to reply
1 reply to this topic

#1 localhost

localhost
  • Members
  • PipPipPip
  • Advanced Member
  • 152 posts

Posted 28 June 2006 - 07:23 PM

$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);
}

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 June 2006 - 07:44 PM

With windows use two \\ like so:
mkdir("files\\$userdir\\$username", 0777);
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users