php question

Imaulle

[H]ard|Gawd
Joined
Jan 13, 2006
Messages
1,213
so basically I'm trying to streamline some website installs with a simple php script.

this is the gist of what I want. I guess I'm just wondering if this chmod is allowed and if that will not mess up any ownership permissons or anything. I'm linux noob

PHP:
<?php
ob_start();
system('unzip Archive.zip');
system('chmod 777 -R folder/images/');
system('chmod 777 -R folder/files/');
system('chmod 777 -R admin/stuff/');
ob_end_clean();
echo "done.";
?>

thanks!
 
Assuming the user the web server is running as owns the directories and files, then it should work.
 
As a note, unless you are trying to capture the direct output of those 4 system calls without getting any output back, you probably don't need ob_start() and ob_end_clean().

Psst, BP!
 
hmmm. just thought of something else I'd like to add to this script lol.. how would I pull in the username from the url to put in a variable?

the url would be like this

http://75.70.40.25/~apple/folder

so I'd like to pull in 'apple' to use in another function. just somehow search for the ~ and then pull in everything up to the /

how would I do that in just a few lines?
 
Be very careful of security issues if using system() with anything other than hardcoded static strings.
 
Back
Top