简体   繁体   English

我们如何用CSV文件中的代码对这一页进行密码保护?

[英]How do we password protect this one page with the codes in CSV file?

How do password protect this one page (on the website developed in PHP) with the codes in CSV file? 密码如何用CSV文件中的代码保护这一页(在PHP开发的网站上)? Any of these codes should allow user access to the page. 这些代码均应允许用户访问该页面。 There is no username. 没有用户名。 Just password which would be random/unique numbers. 只是密码,可以是随机/唯一数字。

How this can be done by server (apache)/htaccess settings. 如何通过服务器(Apache)/ htaccess设置完成此操作。

Thanks! 谢谢!

You would need to get the passwords in memory, so I would use this function to parse it into an array when the page loads: PHP fgetcsv function 您将需要获取内存中的密码,因此在页面加载时,我将使用此函数将其解析为数组: PHP fgetcsv函数

Then, when you have the values in an array, it's easy to traverse through the array and see if the user's password matches any password in the CSV file. 然后,当您在数组中包含值时,就很容易遍历数组并查看用户密码是否与CSV文件中的任何密码匹配。

Hope this works for you. 希望这对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM