so i have the following code and is not working

// Make user folder
            if (!is_dir('../user/'.$name)) {
                $user_folder = mkdir('../user/'.$name, 0777);
                $user_index = copy('../login/user.php', '../user/'.$name.'/index.php');
                if ($handle_append = fopen('../user'.$name.'index.php', 'w')) {
                    echo 'Succes opening the file';
                } else {
                    echo 'Error opening the file';
                    die();
                }
                $string = 'text to write';
                if (fwrite($handle_append, $string)) {
                    echo 'Succes writing the file';
                } else {
                    echo 'Error writing the file';
                    die();
                }
                fclose($handle_append);
                $user_inf = copy('../login/user_inf.php', '../user/'.$name.'/user_inf.php');
            } else {
                echo 'Acest nume de utilizator există deja, te rugăm alege alt nume!';
                exit(); 
            }

i get Succes opening the file and Succes writing the file

i think i just missed a / in front of index.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.