I'm working on a site that when a user registers they will have a ftp user created using proftpd and mysql. What I want to know how to do is authenticate a user as I've never seen a password stored this way before.
INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`,`homedir`,`shell`, `count`, `accessed`, `modified`)
VALUES ('', 'newuser', ENCRYPT('password'), 2001, 2001, '/var/www/accounts/newuser', '/sbin/nologin', 0, '', '');
From here on out I'll have php create the directory and then create a new corresponding table that gives the user all their account details, (IE userprofile with email options etc etc)
So from here the way I've always stored passwords has been
sha1("username:password")
, so the statement has been
$hashpass = sha1(strtoupper($_POST['username']));
$query = <<<SQL
SELECT id
FROM accounts
WHERE password = :hashpass
SQL;
$resource = $this->db->db->prepare( $query );
$resource->execute( array (
":hashpass" => $hashpass,
));
if($resource->rowCount() == 0 ) {
return "Error";
}
else {
//Set the Session
}
What I have no clue on how to do is how to query the password that proftpd stores. Any input would be appreciated.