Open LeChevalierDOr opened 6 years ago
Yes it's possible by using BCrypt. PHP supports BCrypt since 5.5 by default. You just have to use the password_hash
and password_verify
functions and connect PHP to the MySQL/MariaDB storage.
EN
Okay, can I have a sample php code? Also, which file should I configure to connect my MySQL database?
FR
Ok, je peux avoir un exemple de code php ? A aussi quel fichier je dois configurer pour connecter ma base MySQL ?
Also, which file should I configure to connect my MySQL database?
Your PHP code
Pseudo code:
flexiblelogin_users
)
$stmt = $mysqli->prepare('SELECT 1 FROM ' . self::FLEXIBLE_TABLE . ' WHERE UUID = UNHEX(?)');
$stmt->bind_param('s', $bin_uuid);
$stmt->execute();
//check result exists $registered = $stmt->fetch();
4. Hash the password
```PHP
$hash = password_hash($pass);
$stmt = $mysqli->prepare('INSERT INTO ' . self::FLEXIBLE_TABLE . ' (UUID, Username, Password, IP) ' . 'VALUES (UNHEX(?), ?, ?, ?, INET6_ATON(?))');
$stmt->bind_param('sssss', $bin_uuid, $username, $hash, $ip);
return $stmt->execute();
Hi there, I'm new here and I'll very happy if you can help me. I'm trying to do the same but I don't want to use the UUID. I have a Database(already connected to the pluggin and working) but I just want that people login using Username and Password(hashed too). Could you help me with this? what files should I change? Thanks a lot for reading.
EN
Hello it's me again =). Is it possible via your plugin to register on a website? Let me explain: instead of doing a /register on the server is it possible to do this via a website (registration on the site pseudo + password). Thank you in advance.
FR
Bonjour c'est encore moi =). Est-il possible via votre plugin de faire l'enregistrement sur un site web ? Je m'explique : au lieu de faire un /register sur le serveur est t-il possible de faire ça via un site web (inscription sur le site pseudo + mot de passse). Merci d'avance.