如何保护php和文件夹文件免遭未经授权的访问?

时间:2019-07-23 20:41:27

标签: php mysql apache

  1. 我想阻止直接访问不同的php文件(例如,写http://testpage.com/login_verif.php),例如登录验证文件(对用户进行身份验证)。
  2. 用户是否可以访问将他连接到mysql数据库的config.php文件(并在其中写入密码)?
  3. 此外,如何配置uploads文件夹,以便用户只能看到具有其URL的图像?

1 个答案:

答案 0 :(得分:0)

  1. 如果没有数据发布到文件和/或place the file in a more controlled area,则退出文件。
  2. You should not have a config.php file - they are very much not safe, but instead environment variables
  3. 您可以研究rewriting to disallow direct access,但允许在域上进行引用。