We require a php or perl script to copy files from our webspace to our client's webspace, replace some text in some files (it doesn't matter if this is before or after copying - your choice), and then chmods some files.
We want 2 scripts but the code for both should be similar for most of it:
a. Allow them to create a password protected directory on OUR domain first for their use. They can then create another directory in this (step 1 below) to copy files etc from another directory on our webspace.
b. Copy files etc to their own DOMAIN. This domain can be on the SAME server as the original files, etc (if easier).
The basic steps are as follows:
1. A form is displayed where a user enters the path to HIS webspace, his URL (if needed?), and a name for a new directory.
2. Clicks "submit" button.
3. Directory is created in HIS webspace with this new directory name. If directory already exists for another user or error in path, he is told to try again.
4. All files and directories are then copied from a master directory in OUR webspace (URL: [url removed, login to view]), (PATH: "home/local999/www/xfiles/original) to HIS new directory (details from step 1 above).
5. Another form is then displayed with various editboxes: "Name:", "ID Number:".
6. User fills out these editboxes.
7. Clicks "submit" button.
8. Some unique text ("TOKEN1", "TOKEN2", "TOKEN3", etc) already within the code of .php files (including .php files in sub-directories) that were copied to HIS new directory is replaced with the text in the editboxes. All .php files in sub-directories are also searched and text replaced if necessary.
When "TOKEN1 is found in the code of any .php file, it is replaced with the text that the user entered in the "Name" editbox, When "TOKEN2" is found in any file, it is replaced by the text that the user entered in the ID editbox, etc.
Note that it is important that the code in the files is actually changed so, in future, the user can look at "his" page to get the details. It must NOT use a database. If it is not possible to change .php code, I am willing to just have .txt files in the master directories and have the script rename these in the destination to .php extensions, if this works (unless you know a better way) but it is important that the actual .php code is changed.
9. Some files/directories are chmoded to 777: directories called "data" and "content" and files called "[url removed, login to view]" and "content/[url removed, login to view]". Files called "[url removed, login to view]" and "[url removed, login to view]" are chmoded to 755. Please clearly comment the section of code that does this.
10. A webpage is displayed saying "Finished. Thank you for your submission", with a link to one of the files ("[url removed, login to view]") in his newly created directory.
Each section (as above) should be separated with, for example," // ########## COPY START" and " // ########## COPY END" etc and operations well commented throughout for any changes I may wish to make later.
The script must have a consistant look throughout so [url removed, login to view] and [url removed, login to view] files must be included.
During lengthly processes (such as file copying?), something should be displayed, such as a gauge or file names being copied, to let user know that operations are taking place - not just a blank screen.
Also I will own the copyright.