FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

php script for Changing file permissions & owner




Let me present to you a simple PHP script to change the file permissions and file owner using PHP script.
Change file permissions
index.html
Code:

<html>
<head>
</head>
<body>
<form action=chmod.php>
Enter file name
<input name=fname>
<br>
Permission
<input name=perm>
<br>
<input type=submit>
</form>
</body>
</html>


chmod.php
Code:

<?php
chmod($HTTP_GET_VARS['fname'],$HTTP_GET_VARS['perm']);
?>


Change file owner
index.html
Code:

<html>
<head>
</head>
<body>
<form action=chown.php>
Enter file name
<input name=fname>
<br>
FIle Owner
<input name=owner>
<br>
<input type=submit>
</form>
</body>
</html>


chown.php
Code:

<?php
chown($HTTP_GET_VARS['fname'],$HTTP_GET_VARS['owner']);
?>


PS :- For this to work the files must be owned by the user whiich is running the process, else it will not work.

CAUTION :- Be very careful before using such scripts as you might create security loopholes. This is just intended to show what can be done. Such kind of scripts have limited use when you have limited access and you need to make lots of modifications. But, it is better to use control panel provided by your host, as it is more secure.



0 blog comments below




FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.