This is a really quick and simple script that will enable you to CHMOD large amounts of files and folders directly via your browser. Recently i had to install a script, and without exaggeration it required in excess of 100 files/folders to be set to various CHMOD permission levels.
Very tedious indeed switching back and forwards between CuteFTP and translated install documents trying to work out what files need 666, 777 when they weren't even in order and making sure none were missed. So.. I done a quick script, then used a quick macro and find/replace in Notepad++ to add all the file names in to the script in 2 minutes, run it in the browser and the lot was done.
This is a quick demo of the output when run, it has basic error reporting and i purposely botched one file up to show a failed result:
This is the code, feel free to modify it and as you can see it's pretty simple:
PHP Code:
<?php
// Simple CHMOD www.tareeinternet.com
$chmod_777 = array();
$chmod_777[] ='./admin/';
$chmod_777[] ='./admin/keywords.txt';
$chmod_777[] ='./admin/install/';
$chmod_666 = array();
$chmod_666[] ='./admin/config.php';
$chmod_666[] ='./admin/database.txt';
$chmod_666[] ='./admin/words.txt';
for ( $i = 0; $i < count($chmod_777); $i++ )
{
if (!chmod ($chmod_777[$i], 0777))
{
echo '<font color="#DD3333"><b>Oops cannot change permission of (' . $chmod_777[$i] . ')</b></font><br />';
}
else
{
echo '<font color="#228844"><b>Woot chmodded (' . $chmod_777[$i] . ')</b></font><br />';
}
}
for ( $i = 0; $i < count($chmod_666); $i++ )
{
if (!chmod ($chmod_666[$i], 0666))
{
echo '<font color="#DD3333"><b>Oops cannot change permission of (' . $chmod_666[$i] . ')</b></font><br />';
}
else
{
echo '<font color="#228844"><b>Woot chmodded (' . $chmod_666[$i] . ')</b></font><br />';
}
}
?>
To use, save it as chmod.php then upload it to your public_html and execute it by going to Domain.com/chmod.php