We require a php script to copy files from our webspace to our client's webspace, replace some text in some files 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 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. Another form is then displayed with 1 editbox: "Country:"
9. Clicks "submit" button.
10. Some unique text ("TOKEN1", "TOKEN2", "TOKEN3", etc) already in all files (including files in sub-directories) that were copied to HIS new directory is replaced with the text in the editboxes. All files in sub-directories are also searched and text replaced if necessary.
When "TOKEN1 is found in any 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 text 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.
11. 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]".
12. 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" 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.