how to check server permissions
Moderator: General Moderators
how to check server permissions
hi
I need a code to see does the server give the script write & delete permissions or not.
thanks
I need a code to see does the server give the script write & delete permissions or not.
thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: how to check server permissions
any other
(more simple) solutin?
(more simple) solutin?
Re: how to check server permissions
That's as simple as it gets, my friend.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: how to check server permissions
Did you bother to read the manual? Assuming you want an octal value,
would return something like 0777 if it was writtable.

Code: Select all
echo substr(sprintf('%o', fileperms('/path/to/your/file.txt')), -4);Re: how to check server permissions
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!
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
Do you know how to program? do you know PHP?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: how to check server permissions
You don't have to echo anything.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!
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
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
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
I've doneit the way you say as I said!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
Yes Cause I'm here to learnDo you know how to program? do you know PHP?