Jump to content

[SOLVED] PHP to create or copy a php file into a directory


5kyy8lu3

Recommended Posts

Hi!  I just wrote a web app for my website that's kinda like photobucket.

 

When an account is created, it makes a table named username_data and also a folder in the pictures directory called username_data and username_data2. (username being whatever the login name of the person is logged in)

 

I would like to find out how to make/write code that also puts in an index.php file into those two directories so people can\'t just go and see the contents of the member\'s picture folders.  ideally, i\'d like that index.php file to be <?php header("Location: http://www.mywebsite"); ?>

 

i could manually do this myself but i would love for this to be automated.

 

any ideas? thanks

ok I figured it out, it was pretty simple, here's the code so if anyone searches for this later they can take a peek

 

$username = scrubber($_POST['name'], $cxn);
mkdir("pix/".$uzername."_data", 0755);
mkdir("pix/".$uzername."_data2", 0755);
$file_ = "pix/index.php";
$newfile = "pix/" . $uzername . "_data/index.php";
$newfile2 = "pix/" . $uzername . "_data2/index.php";
copy($file_, $newfile);
copy($file_, $newfile2);

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.