Jump to content

Mkdir Problems


lpxxfaintxx

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!
Link to comment
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]
Link to comment
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.
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.