Jump to content

Archived

This topic is now archived and is closed to further replies.

lpxxfaintxx

Mkdir Problems

Recommended Posts

I have

[code]<?php
$ownerdir = $owner;
define ('DIRECTORY', '/home/lpxxfain/public_html/members/'.$ownerdir);

UPLOAD CODE HERE

do {
   $dir = DIRECTORY;
   while (!is_dir($dir)) {
       $basedir = dirname($dir);
       if ($basedir == '/' || is_dir($basedir))
           mkdir($dir,0777);
       else
           $dir=$basedir;
   }
} while ($dir != DIRECTORY);

REST OF CODE HERE

?>[/code]

It never makes the folder, and just skips on to the rest of the script. I don't know whats wrong :(

If I do a simple [code]<?php
mkdir("/home/lpxxfain/public_html/members/testing", 0700);
?> [/code], it works and makes the folder but if I do

[code]
<?php
mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);
?> [/code] then it says the folder already exists when it doesnt.

Ahh, I'm so frustrated!

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

If I do a simple [code]<?php
mkdir("/home/lpxxfain/public_html/members/testing", 0700);
?> [/code], it works and makes the folder but if I do

[code]
<?php
mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);
?> [/code] then it says the folder already exists when it doesnt.
[/quote]



echo out $owner.

Cheek to see what the varable is holding.

Try this should make a dir me.
[code]
<?php
$owner="me";
mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);
?>
[/code]

[code]
$owner is not set see my above example.
<?php

$owner="john";// This will work now with the dir john.
$ownerdir = $owner;
define ('DIRECTORY', '/home/lpxxfain/public_html/members/'.$ownerdir);

UPLOAD CODE HERE

do {
   $dir = DIRECTORY;
   while (!is_dir($dir)) {
       $basedir = dirname($dir);
       if ($basedir == '/' || is_dir($basedir))
           mkdir($dir,0777);
       else
           $dir=$basedir;
   }
} while ($dir != DIRECTORY);

REST OF CODE HERE

?>
[/code]

Share this post


Link to post
Share on other sites
are other directories created using scripts? (I see the dir name is given by the owner name).

Have a look and see if openbasedir is set in your php.ini - if it is no php script will be able to conductg and file/directory manipulation outside that directory.

Share this post


Link to post
Share on other sites

×

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.