Jump to content

Duplicating a master file


gerkintrigg

Recommended Posts

I wrote a script to automatically generate a folder with an index page in it using data from a database record, but it only operates when the administrator activates the record. I've worked out nearly all of it, but is there a simple way to copy the original contents of the master file, but leave the original intact?

 

I'm not getting any errors, and the directory is being created, but it's empty.

 

So-far I have:

 

$path_to_file=$root.$shop_name.'/index.php';
if(!file_exists($path_to_file)){
mkdir($root.$shop_name,'0777');
copy($root.'members/do-not-delete.php', $root.$shop_name.'/index.php');
}

 

I can't see anything wrong with the code and all the Google snippets seem to suggest this is the way to do it.

 

Help, please.

Neil

Link to comment
https://forums.phpfreaks.com/topic/273885-duplicating-a-master-file/
Share on other sites

I am using Mod Rewrite too, but this creates a blank page to work from so they can customise it themselves.

I'm fine with doing it this way and there are reasons for it which I won't go into now, but needless to say I need a subdirectory (a real one) for each new shop.The only issue is how to duplicate the file.

You should check your error logs, and see if you get an error message returned.

Also, remove the quotes around the permissions. They prevent the mode from being parsed as an octal:

php > echo 0777;
511
php > echo intval ('0777');
777

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.