homepage Welcome to WebmasterWorld Guest from 54.205.205.47
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
File Permissions...?
Can PHP alter a file's permissions?
ahmedtheking




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

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




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

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

mavherick

ahmedtheking




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

Cool thanks!

vincevincevince




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

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




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

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

ahmedtheking




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

Ah, so are there any ways around this?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved