Page 1 of 1
how to check server permissions
Posted: Mon Nov 24, 2008 3:59 pm
by Blondy
hi
I need a code to see does the server give the script write & delete permissions or not.
thanks
Re: how to check server permissions
Posted: Mon Nov 24, 2008 4:21 pm
by John Cartwright
Re: how to check server permissions
Posted: Tue Nov 25, 2008 7:39 am
by Blondy
any other
(more simple) solutin?
Re: how to check server permissions
Posted: Tue Nov 25, 2008 2:20 pm
by Syntac
That's as simple as it gets, my friend.
Re: how to check server permissions
Posted: Thu Nov 27, 2008 2:42 pm
by John Cartwright
Did you bother to read the manual? Assuming you want an octal value,
Code: Select all
echo substr(sprintf('%o', fileperms('/path/to/your/file.txt')), -4);
would return something like 0777 if it was writtable.

Re: how to check server permissions
Posted: Mon Dec 01, 2008 4:57 am
by Blondy
I can't echo some 0777 for user
I just want to see if can my script create a file or not, delete a filer not somehow I solved it thanks
bro if you have a way will be good to know!
Re: how to check server permissions
Posted: Mon Dec 01, 2008 5:20 am
by Eran
Do you know how to program? do you know PHP?
Re: how to check server permissions
Posted: Fri Dec 05, 2008 1:40 pm
by John Cartwright
Blondy wrote:I can't echo some 0777 for user
I just want to see if can my script create a file or not, delete a filer not somehow I solved it thanks
bro if you have a way will be good to know!
You don't have to echo anything.
Code: Select all
if (substr(sprintf('%o', fileperms('/path/to/your/file.txt')), -4)) {
//you have read/write/execute permission
//do whatever you want
}

Re: how to check server permissions
Posted: Fri Dec 05, 2008 1:56 pm
by airy
try it and then you know the answers
try to create a file,u'll know weather you can.try to delete a file and u'll know weather you have the permission
Re: how to check server permissions
Posted: Sat Dec 06, 2008 8:01 am
by Blondy
try it and then you know the answers
try to create a file,u'll know weather you can.try to delete a file and u'll know weather you have the permission
I've doneit the way you say as I said!
Do you know how to program? do you know PHP?
Yes Cause I'm here to learn
