首页 > 代码库 > pureftpd.passwd解析
pureftpd.passwd解析
将pureftpd.passwd文件的内容转换成sql语句,导入到mysql
pureftp.passwd格式:
<account>:<password>:<uid>:<gid>:<gecos>:<home directory>:<upload bandwidth>:
<download bandwidth>:<upload ratio>:<download ratio>:<max number of connections>:
<files quota>:<size quota>:<authorized local IPs>:<refused local IPs>:
<authorized client IPs>:<refused client IPs>:<time restrictions>
<?php // 将pureftpd.passwd转换成sql语句 pureftp(); function pureftp() { $filename = "pureftpd.passwd"; $fd = fopen($filename, "r"); while (!feof($fd)) { $line = fgets($fd); // echo $line ; if (trim($line) != "") handle_lines($line); } } function handle_lines($line) { $user_info = explode(":", $line); $username = $user_info[0]; $password = $user_info[1]; $uid = $user_info[2]; $gid = $user_info[3]; $gecos = $user_info[4]; $home = $user_info[5]; $sql = "INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`) " . " VALUES (‘{$username}‘, ‘1‘, ‘{$password}‘, " . "‘{$uid}‘, ‘{$gid}‘," . "‘{$home}‘);"; echo "$sql\n"; } ?>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。