需要密码才能访问页面
我正在为我的教授编写一个数据输入表单,以便将 Herbarium 数据输入 MySQL 数据库。我用 PHP 编写了一个 Web 表单来输入数据,并将其托管在服务器上。
但是,我不希望任何人都能够输入数据。我想设置一个简单的用户名/密码提示,并将凭据提供给当前的数据输入打字员。
I'm writing a data entry form for my professor to enter Herbarium data into a MySQL database. I've written up a web form in PHP to enter in the data, and hosted it on a server.
However, I don't want just anyone to be able to enter in data. I'd like to set a simple username/password prompt, and give the credentials to the current data entry typist.
Is there any way of doing it simply like this a linksys router prompt? I need to get this site functional as soon as possible, and will develop something more secure later.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 .htaccess 文件(与.htpasswd 文件)。
只要您的登录名/密码数量有限,这非常容易设置,并且可以提供良好的保护(标准 Apache 功能)。
Use an .htaccess file (combined with a .htpasswd file).
This is very easy to set up, and a good protection (standard Apache functionnality) as long as you have a limited number of logins/passwords.
使用会话并制作另一个接受用户名和密码的表单。验证数据库的用户名和密码。
您可以通过散列或加盐来创建安全密码(您可以通过谷歌搜索如何做到这一点)。
如果用户名和密码不匹配,请再次转到登录页面,如果匹配,则重定向到您创建的主表单。在包含表单的页面上,请确保以以下内容开头:
Use the session and make another form that accepts username and password. Validate the username and password to your database.
You can make secure passwords by hashing or salting it (you can google how to do that).
If the username and password don't match make them go to the login page again, and if they do match redirect to the main form that you made. On the page with the form make sure you start it with: