Results 1 to 9 of 9

Thread: mkdir function

  1. #1
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default mkdir function

    ive finally worked out how to use the mkdir function with a username variable so when a user signs up it creates a dir with there username.

    Now, i want to create 3 dirs inside that one automatically..

    anyone no how i can do this?

    +rep for help

    Thanks

    Chris
    Looking for a good desiner to design a social networking template.

    PM me.

  2. #2
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    Use the same function afterwards to create the dirs inside.

    I would highly recommend you use htaccess to do this, look in my thread about SEO in the tutorial section for some help.

  3. #3
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    My code is:

    Code:
    $username= $_POST[username]
    $name = $_SERVER['DOCUMENT_ROOT'] . "/test/" . $username;
    if (!is_dir($username))
    { 
    mkdir($name, 0777);
    }
    I try adding that again but with the others and it gives me errors ;l
    Looking for a good desiner to design a social networking template.

    PM me.

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    $username$_POST[username]
    $name $_SERVER['DOCUMENT_ROOT'] . "/test/" $username;
    if (!
    is_dir($username))

    mkdir($name0777);
    mkdir(". $name ."/folder10777);
    mkdir(". $name ."/folder20777);
    mkdir(". $name ."/folder30777);

    Never used the mkdir function, so I'm pretty sure it won't work, lol.

  5. #5
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    PHP Code:
    $username$_POST[username]
    $name $_SERVER['DOCUMENT_ROOT'] . "/test/" $username;
    if (!
    is_dir($username))

    mkdir($name0777);
    mkdir(". $name ."/folder10777);
    mkdir(". $name ."/folder20777);
    mkdir(". $name ."/folder30777);

    Never used the mkdir function, so I'm pretty sure it won't work, lol.
    Tried that and got:

    Code:
    Warning:  Division by zero in /home2/****/public_html/test/register.php on line 17
    
    Warning:  mkdir() [function.mkdir]: No such file or directory in /home2/****/public_html/test/register.php on line 17
    
    Warning:  Division by zero in /home2/****/public_html/test/register.php on line 18
    
    Warning:  mkdir() [function.mkdir]: No such file or directory in /home2/****/public_html/test/register.php on line 18
    
    Warning:  Division by zero in /home2/edaggcom/public_html/test/register.php on line 19
    
    Warning:  mkdir() [function.mkdir]: No such file or directory in /home2/edaggcom/public_html/test/register.php on line 19
    
    Looking for a good desiner to design a social networking template.

    PM me.

  6. #6
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Sorted - Closed

    +rep for both
    Looking for a good desiner to design a social networking template.

    PM me.

  7. #7
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Opened again becuase the files created are not chmoding to 777
    Looking for a good desiner to design a social networking template.

    PM me.

  8. #8
    Join Date
    Oct 2006
    Location
    Northampton
    Posts
    694
    Tokens
    142

    Default

    Post your code...
    Good-bye signature, I love <NOT ALLOWED NAME AT ALL> despite the infraction his last name got me.

    Free speech? Not anymore, you gotta' love this forum.

  9. #9
    Join Date
    Dec 2006
    Posts
    521
    Tokens
    0

    Default

    chmod($dir1); etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •