$pagename = $username; $basefile = 'athbase.php'; $newfile = $pagename.".php"; copy($basefile, $newfile); if (!copy($basefile, $newfile)) { echo "failed to create $newfile."; } $newFileContent = "
this was a test file...
"; if (file_put_contents($newfile, $newFileContent) !== false) { echo "File created (" . basename($newFileName) . ")"; } else { echo "Cannot create file (" . basename($newFileName) . ")"; }