密码保护页面和文件 [英] Password Protect Pages and Files

查看:77
本文介绍了密码保护页面和文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个PHP登录名,用于在SQL数据库中存储用户名和密码。我已将PHP代码添加到受保护的网页,要求用户登录才能访问它们。所有受保护的文件都位于单个目录中。这样可以保护
访问目录中的PHP页面,但是目录中的任何文件或文档都不受保护,只有页面受到保护。我想要做的是使用  .htaccess / .htpasswd密码保护整个直接。


有没有办法从SQL数据库更新这些文件。我正在寻找的是一种在用户注册,更改密码或从SQL数据库中删除密码时更新.ht文件的方法。如果不可能,我可以存储用户名/密码
来访问SQL数据库中的受保护目录,并在成功登录时动态地将其传递给.ht登录名吗?


我的主机提供商是Blue Host(Linux / Apache);我有带有Service Pack 2的Expression Web 3


谢谢,Wayne

解决方案

阅读此链接在使用Apache进行访问控制  


您不会在SQL表与
AuthUserFile /www/passwords/password.file之间建立直接连接,而无需使用脚本来执行此操作。基本上创建一个触发器,在修改特定表时运行更新脚本。


 


 


I have written a PHP login that stores user names and passwords in a SQL data base. I have added the PHP code to my protected web pages requiring the user to be logged in to access them. All protected files are located in single directory. This protects access to my PHP pages in the directory but any files or documents located in the directory are not protected, only the pages are protected. What I would like to do is password protect the entire directoty using .htaccess/.htpasswd.

Is there a way to update the these files from the SQL data base. What I am looking for is a way update the .ht files when my users register, change their password, or when they are removed from the SQL data base. If this is not possable can I store the username/password for accessing the protected directory in the SQL data base and dynamically pass it to the .ht login when they sucessfully log in?

My host provider is Blue Host (Linux/Apache); I have Expression Web 3 with service pack 2

Thanks, Wayne

解决方案

Read this link on Access Control with Apache  

You are not going to get a direct connection between your SQL tables and the AuthUserFile /www/passwords/password.file without using a script to do it. Basically create a trigger which runs your update script when that specific table is modified.

 

 


这篇关于密码保护页面和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆