Hello,

Have this small script:

<?php

$dirname = $_POST["username"];

$filename = "/folder script in//{$dirname}/";

    if (file_exists($_POST["username"];)) {    
      header ( "Location: " . $_POST["username"]);
    } else {    
        mkdir("folder script in// {$dirname}", 0777);    
        echo "welcome " . $_POST["username"] . "Your Area Is Being created.";    
  }    

?>

When a member logs in this scripted is called, it SHOULD either direct an existing member to their area, or create a new folder if the member has just joined.

When i do run it this error message happens:

Warning: mkdir() [function.mkdir]: Permission denied in /home/vars1/public_html/var2/vars3/var4/var5/var6/file on line 8
welcome Your Area Is Being created.

This looks to me as if the script is trying to write to the folder it's located in, that will not happen, because the write permissions on that folder will not allow that.

I want the script to create a directory two folders deeper, how can I do this? (the folder I want the script to write to has write permissions turned on (0777)).

please can anyone help me with this, I still have to get the files moved from one folder to another when this is done, but can't even begin works on that, (you can move files with php, just I haven't seen a move command in my book)?

DG

    give mkdir the full server path to where you want it to make the dir

      dagon; wrote:

      give mkdir the full server path to where you want it to make the dir

      Hello, Tried that and now get this error message:

      Warning: Cannot modify header information - headers already sent by (output started at /home/vars1/public_html/2/3/4/5t/6n/crete.php:1) in /home/vars/public_html/1/2e/3n/4t/5n/6te.php on line 6

      anyway around this, or what am I doing wrong now, this is proving harder than I thought...

      Altered script like this:

      <?php

      $dirname = $_POST["username"];

      $filename = "/home/vars/public_html/1in/2e/3on/4st/5n/6rds/7trol/{$dirname}/";

          if (file_exists($filename)) {    
            header ( "Location: " . $_POST["username"]);
          } else {    
              mkdir("/home/vars/public_html/1n/2re/3on/4st/5in/6rds/7rol/{$dirname}", 0777);    
              echo "welcome " . $_POST["username"] . "Your Area Is Being created.";    
        }    

      ?>

      DG

        there's output in the file specified which there cant be before the use of header()

          dagon; wrote:

          there's output in the file specified which there cant be before the use of header()

          Is there anyway I can change this to get it to work, I would really appreciate any suggestions?

          DG

            Hello, Still have problems, but have resolved this one. If you have a problem like this with headers there is another way to resolve it other than just "remove output" which maybe a little inconvenient.
            <?php
            ob_start();
            header ( "Location: " . "bla" . bla"];
            output
            header ( "Location: " . "bla" . bla"];
            ob_end_flush();

            ?>

            try it there will be no error message, it works because all output is cached then released when the flush () function is called..

            DG

              Write a Reply...