开发者

Creating and accessing a private folder on my server

开发者 https://www.devze.com 2023-02-18 17:15 出处:网络
i want to be able to make a folder where users upload content too, and then an admin can use a password possibly to view the folder and make choices on to approve or reject the content.best way to do

i want to be able to make a folder where users upload content too, and then an admin can use a password possibly to view the folder and make choices on to approve or reject the content. best way to do 开发者_开发技巧this?


A secure and easy way is to do it with .htaccess and .htpassword to allow only specific people to access the directory.


Use chown to change the file/folder owner. In the php docs they say it works for files, but folders are just files and it should work. If it doesnt use shell_exec and use the OS chown (on *nix , donno about windows).

Alternatively you can use HTTP authentication, if the folder is on a public path. I would not recommend .htaccess unless you are out of options. Htaccess were created for other reasons. Use the correct tools for each problem (see Golden Hammmer).

0

精彩评论

暂无评论...
验证码 换一张
取 消