require 'nLogin.php';
// Creates an instance
$nlogin = new nLogin("localhost", "root", "", "nlogin", false);
require 'nLogin.php';
// Creates an instance
$nlogin = new nLogin("localhost", "root", "", "nlogin", false);
// Fetches the user identifier (search, mode)
$user_id = $nlogin->fetch_user_id("Player", nLogin::FETCH_WITH_LAST_NAME);
// Verifies the password
$is_valid = $nlogin->verify_password($user_id, "password123");
require 'nLogin.php';
// Creates an instance
$nlogin = new nLogin("localhost", "root", "", "nlogin", false);
// Fetches the user identifier (search, mode)
$user_id = $nlogin->fetch_user_id("Player", nLogin::FETCH_WITH_LAST_NAME);
// Registers a player (username, plain password, e-mail, unique id (optional), mojang id (optional), bedrock id (optional))
$success = $nlogin->register($user_id, "password123", '[email protected]', null, null, null);
require 'nLogin.php';
// Creates an instance
$nlogin = new nLogin("localhost", "root", "", "nlogin", false);
// Fetches the user identifier (search, mode)
$user_id = $nlogin->fetch_user_id("Player", nLogin::FETCH_WITH_LAST_NAME);
// Changes the password (user identifier, new plain password)
$success = $nlogin->change_password($user_id, "newpassword123");
This code or part of it was taken from the AuthMe project, licensed under the GNU General Public License v3.0 (https://github.com/AuthMe/AuthMeReloaded/blob/master/LICENSE)
For more details, access the original source code:
https://github.com/AuthMe/AuthMeReloaded/tree/master/samples/website_integration
If you use Node.js, take a look at the work done by tiagodinis33: https://gitlab.com/tiagodinis33/nlogin-js