####### English Version ########
Hello Everyone!.
I am requesting a script to change username in php, someone would be so kind as to contribute?.
Thanks in advance
Version Español
Hola a todos.
Estoy necesitando un codigo php para cambiar el nombre de usuario, alguno podria aportarlo?
se los agradeceria mucho. saludos!
Version: TrinityCore 3.3.5a.
I can’t guarantee this would work right because of how TC handles logins, but in theory
class Account {
public function __construct() {
$this->db = new db();
}
public function ChangeUsername($arg, $arg2) {
$userup = strtoupper($arg);
$passup = strtoupper($arg2);
$query = <<<SQL
UPDATE account
SET username = :arg
AND sha_pass_hash = :arg2
SQL;
$resource = $this->db->db->prepare( $query );
$resource->execute( array (
":arg" => $userup,
":arg2" => sha1($userup.':'.$passup),
));
}
Simply Define Your Database Connection and then call the script with
$account = new Account();
$account->ChangeUsername($_POST[‘username’],$_SESSION[‘sha’]);
This is a very rough draft, but if you know what you’re doing with any of the code then it wouldn’t be hard to implement. However I can’t say I would recommend it regardless.