create.php
<?php
 
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3      ##
###########################################################################
## This is a script that creates accounts for mangos servers.            ##
###########################################################################

###########################################################################
##                            CONFIGURATION                              ##
###########################################################################

# The configuration file for this script containing the settings.
include_once("config.php");
 
###########################################################################
##                               INTERNALS                               ##
###########################################################################

if(!isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['email'])) {
    print "All fields must be completed in order to register an account!";
    die;
}
 
try {
    $db = new PDO('mysql:host='.$DATABASE_HOSTNAME.';dbname='.$DATABASE_REALM_NAME.';', 'mangos', 'mangos');
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->beginTransaction();
    $q = $db->prepare("INSERT INTO $DATABASE_REALM_NAME.account (username, sha_pass_hash, email) VALUES(:username,:password,:email)");
    $q->execute(
        array(
            ':username' => $_POST['username'],
            ':password' => strtoupper(
                sha1(
                    strtoupper($_POST['username']) . ":" . strtoupper($_POST['password'])
                )
            ),
            ':email' => $_POST['email']
        )
    );
    $db->commit();
}
catch(PDOException $e) {
    switch($e->errorInfo[1]) {
        case 1062:
            print "Account already exists.";
            break;
        default:
            print $e->getMessage();
            break;
    }
    $db->rollback();
    die;
}
 
print "Account created.";
 
?>

mangos/create_account/create.php.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.