[英]How can I check if a user is disabled in PHP?
I'm writing a PHP program to list user information. 我正在编写一个PHP程序来列出用户信息。
I want to check if a user in /etc/passwd is disabled, so I have to check if a specific user has password like * or ! 我想检查是否禁用了/ etc / passwd中的用户,因此我必须检查特定用户的密码是否为*或! in /etc/shadow file.
在/ etc / shadow文件中。
Here is the problem, my Apache server has no access to shadow file, and I think reading shadow file is not safe in any case. 这是问题所在,我的Apache服务器无法访问影子文件,并且我认为在任何情况下读取影子文件都不安全。
Can anyone help me with this problem? 谁能帮助我解决这个问题?
/etc/passwd
is Apache Folder and this folder is private... /etc/passwd
是Apache文件夹,这个文件夹是私有的...
You can't Access to it in most servers! 您无法在大多数服务器中访问它!
if user disabled on server ,he can't access to run php! 如果用户在服务器上禁用,他将无法运行php!
I/ Fetch the results with a root shell script run with cron. I /使用cron运行的root shell脚本获取结果。
for line in /etc/shadow store in /var/www/.../users.status.php
<?php die("do not open this file"); ?>
username:Active
username2:Inactive
...
II/ Make the php script that tests the created file with user submitted value... II /制作php脚本,以用户提交的值测试创建的文件...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.