Jump to content


Photo

Mkdir Problems


  • Please log in to reply
2 replies to this topic

#1 lpxxfaintxx

lpxxfaintxx
  • Members
  • PipPipPip
  • Advanced Member
  • 181 posts

Posted 22 March 2006 - 10:16 PM

I have

<?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

?>

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
<?php
mkdir("/home/lpxxfain/public_html/members/testing", 0700);
?>
, it works and makes the folder but if I do

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

Ahh, I'm so frustrated!

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 22 March 2006 - 11:52 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

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

<?php
mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);
?>
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.
<?php
$owner="me";
mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);
?> 

$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

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 23 March 2006 - 01:02 AM

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.
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users