1. Go to this page and download the library: Download laizerox/php-wowemu-auth library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
$client = new UserClient($username, $saltFromDatabase);
$verifier = strtoupper($client->generateVerifier($password));
php
/* login.php */
rClient;
/* Connect to your CMaNGOS database. */
$db = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);
/* Function to get values from MySQL. */
function getMySQLResult($query) {
global $db;
return $db->query($query)->fetch_object();
}
/* If the form has been submitted. */
if (isset($_POST['login'])) {
$username = $_POST['username'];
$password = $_POST['password'];
/* Get the salt and verifier from realmd.account for the user. */
$query = "SELECT s,v FROM account WHERE username='$username'";
$result = getMySQLResult($query);
$saltFromDatabase = $result->s;
$verifierFromDatabase = strtoupper($result->v);
/* Setup your client and verifier values. */
$client = new UserClient($username, $saltFromDatabase);
$verifier = strtoupper($client->generateVerifier($password));
/* Compare $verifierFromDatabase and $verifier. */
if ($verifierFromDatabase === $verifier) {
/* Do your login stuff here, like setting cookies/sessions... */
}
else {
/* Do whatever you wanna do when the login has failed, send a failure message, redirect them to another page, etc... */
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.