How to define a owner, group and others through PHP?
Whenever we use chmod, we set different authorities to different users type开发者_运维问答s like
owner, group, others, all
What I dont know is, how do define who is owner, who is group and who are others.
Can we use this while implementing login system? What I mean is, by verifying a username, I want to define if the logged in user is owner, a group or others so that I can deny access to file or folder.
May be my title does not reflect the question, if someone with rep power finds a better title, please edit it?
Are you trying to use file system permissions to allow or deny access to the files served by php, or to php scripts themselves?
This is not possible. There is always one and only one user who runs apache and php. What that user is called depends on your system: it could be called "apache" or "www" or even "nobody".
When you implement a login system to your website, you are not dealing with this. When you implement a login system, you are doing nothing more than associating a token to the current session. Then according to the token you can change the normal course of the php script (allowing or denying access, display one or another data template, etc...). But, for the operating system, there is absolutely no difference.
You should take a look at some php tutorials about authentication. If you don't want to implement one yourself, this is a viable solution: http://framework.zend.com/manual/en/zend.auth.introduction.html
精彩评论