Welcome to WebmasterWorld Guest from 107.20.5.156

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

File Permissions...?

Can PHP alter a file's permissions?

     

ahmedtheking

7:53 pm on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have written a CMS system (with the help of all of you who had posted replies to me! Thanks!) that adds/modifies/deletes rows (pages) within a database (site).

My next thing is to make the CMS system load up HTML or text files and edit them!

I know that using the fopen command and the write commands, the CHMOD of the file has to be writeable, but this opens up a security flaw.

Is there anyway that a PHP command could change the CHMOD of a file before it is opened to make it writable and then change it back to just read?

mavherick

8:11 pm on Jan 5, 2005 (gmt 0)

10+ Year Member



Yes you can, you can use the chmod [ca3.php.net] function.

mavherick

ahmedtheking

1:59 am on Jan 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool thanks!

vincevincevince

11:37 am on Jan 6, 2005 (gmt 0)

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



There is no advantage in doing this I'm afraid... anyone in a position to edit an owner-writable file also has permission to chmod it writable if it's read only anyway.

dreamcatcher

12:15 pm on Jan 6, 2005 (gmt 0)

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Just a quick note also to say that if your server has Safe Mode enabled, the chmod function may not work.

ahmedtheking

12:33 pm on Jan 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, so are there any ways around this?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month