Skip to content

Failed to authenticate with the script using trinity core. #4

@NukedBart

Description

@NukedBart

Here's my register function implementation:

/* Connect to your CMaNGOS database. */
$db = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);

/* If the form has been submitted. */
if (isset($_POST['register'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $email = $_POST['email'];
    
    /* Grab the users IP address. */
    $ip = $_SERVER['REMOTE_ADDR'];
    
    /* Set the join date. */
    $joinDate = date('Y-m-d H:i:s');
    
    /* Set GM Level. */
    $gmLevel = '0';

    /* Set expansion pack - Wrath of the Lich King. */
    $expansion = '2';
    
    /* Create your v and s values. */
    $client = new UserClient($username);
    $salt = $client->generateSalt();
    $verifier = $client->generateVerifier($password);

    /* Insert the data into the CMaNGOS database. */
    try{
        mysqli_query($db, "INSERT INTO account (username, verifier, salt, reg_mail, email, joindate, last_ip, expansion) VALUES ('$username', 0x$verifier, 0x$salt, '$email', '$email', '$joinDate', '$ip', '$expansion')");
        mysqli_query($db, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid = account.id WHERE acctid IS NULL");
    }
    catch(Exception $e){
        echo '';
    }
    /* Do some stuff to let the user know it was a successful or unsuccessful attempt. */
    echo "INSERT INTO account (username, verifier, salt, reg_mail, email, joindate, last_ip, expansion) VALUES ('$username', '0x$verifier', '0x$salt', '$email', '$email', '$joinDate', '$ip', '$expansion')";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions