5kyy8lu3 Posted December 15, 2008 Share Posted December 15, 2008 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 Link to comment https://forums.phpfreaks.com/topic/136987-solved-php-to-create-or-copy-a-php-file-into-a-directory/ Share on other sites More sharing options...
waynew Posted December 15, 2008 Share Posted December 15, 2008 You're creating a table for each user? Link to comment https://forums.phpfreaks.com/topic/136987-solved-php-to-create-or-copy-a-php-file-into-a-directory/#findComment-715508 Share on other sites More sharing options...
5kyy8lu3 Posted December 15, 2008 Author Share Posted December 15, 2008 You're creating a table for each user? yea to save the filename and description of the picture EDIT: this isn't going to be commercial, it's just for me, my friends, and family to use who hate photobucket Link to comment https://forums.phpfreaks.com/topic/136987-solved-php-to-create-or-copy-a-php-file-into-a-directory/#findComment-715511 Share on other sites More sharing options...
xtopolis Posted December 15, 2008 Share Posted December 15, 2008 You could do this with a .htaccess file Options -Indexes (will disallow directory viewing) You'll have to google it though, im not that good with .htaccess Link to comment https://forums.phpfreaks.com/topic/136987-solved-php-to-create-or-copy-a-php-file-into-a-directory/#findComment-715512 Share on other sites More sharing options...
5kyy8lu3 Posted December 15, 2008 Author Share Posted December 15, 2008 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); Link to comment https://forums.phpfreaks.com/topic/136987-solved-php-to-create-or-copy-a-php-file-into-a-directory/#findComment-715563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.