I want to check files and directorys on the internet for the chmod
so if the file CHMOD = .....
then $ok = true
can some on do this for me?
thanks
Um.
I could do it. I'm not going to do it. That would likely be against the rules. I can think of 2 reasons one would want to do this, and the acceptable reason is not likely to be the one you intend to use it for. 
I don't under stand
I want to release a script i made but in the install doc i need it to check a few file permissions.
whats wrong with that?
| DanielXP wrote: |
I want to check files and directorys on the internet for the chmod
so if the file CHMOD = .....
then $ok = true
can some on do this for me? |
What do you mean "on the internet"?
Anyway, have a look at fileperms().
| Code: |
$ok = false;
if (fileperms('file_to_check') == 0777) $ok = true; |
| hexkid wrote: |
| What do you mean "on the internet"? |
Don't have a clue
| hexkid wrote: |
| Code: | $ok = false;
if (fileperms('file_to_check') == 0777) $ok = true; |
|
Thanks 
i keep getting this error
Warning: chmod() [function.chmod]: Operation not permitted in /home/....../public_html/...../install/index.php on line 51
| DanielXP wrote: |
i keep getting this error
Warning: chmod() [function.chmod]: Operation not permitted in /home/....../public_html/...../install/index.php on line 51 |
| http://www.php.net/chmod wrote: |
| Note: The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems. |
In my opinion it's a very good thing that the user running the webserver cannot change the file permissions. Maybe you should rewrite your script such that it doesn't need write access to index.php ...
No thats just the installion if the files and directos are not what they should be it will make the it
also mine keeps saying
Config.php is not writable (CHMOD to 777)
Settings.php is not writable (CHMOD to 777)
Backups/ is not writable (CHMOD to 646s)
Uploads/ is not writable (CHMOD to 777)
althought they are
Daniel, IMNSHO, it would seem being able to have a script to scan a web site's files for chmod status would be an easy way to find targets for hacking. 
Can you run this script? | Code: |
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
header('Content-Type: text/plain');
$f = @fopen('lstest', 'wb');
if ($f) {
fwrite($f, "test\n");
fclose($f);
} else {
echo "Unable to create 'lstest' file.\n\n";
}
echo `ls -l`; /* ATTENTION: these are backticks! */
?> |
When I run it on my "root" directory on frihost, it complains that it can't create the 'lstest' file and all the files displayed are owned by me | Code: |
...
-rw-r--r-- 1 hexkid hexkid 147 Jun 24 19:21 index.html
... |
This means only me can chmod these files and that the user running the webserver does not have write access to my "root" directory.