Jump to content
V3ct0r

How to create an account

Recommended Posts

How to create an account

761612ddd393t.jpg

1) Open MSSQL Management Studio. Connect to SQL Server and create a new query by pressing 'New Query' button on tool bar or hotkey CTRL + N.

2) Enter the following SQL Query:

USE AccountServer;
INSERT INTO account_login (name, password) VALUES ('<Login>', '<Password>')

Where:

  • <Login> - Login for new account;
  • <Password> - MD5 hash of password for new account in upper case.

You can get MD5 hash for passwords using special services:

  1. http://www.md5.cz/
  2. http://www.md5online.org/md5-encrypt.html
  3. http://onlinemd5.com/

Example: you need to make account 'PKODev' with password '123456', so you have to execute the following SQL Query:

USE AccountServer;
INSERT INTO account_login (name, password) VALUES ('PKODev', 'E10ADC3949BA59ABBE56E057F20F883E')

3) If you need GM-account, you have to exequte one more SQL Query:

USE GameDB;
INSERT INTO account (act_id, act_name, gm) VALUES ((SELECT MAX(act_id) + 1 FROM account), '<Login>', <GM-level>);

Where:

  • <Login> -  Login for new account;
  • <GM-Level> - GM level of the account.

Example:

USE GameDB;
INSERT INTO account (act_id, act_name, gm) VALUES ((SELECT MAX(act_id) + 1 FROM account), 'PKODev', 99);

 

As the result, we have created a new account with GM level 99.

  • Like 1

Share this post


Link to post
Share on other sites

You can also hash directly like:

INSERT INTO account_login (name, password)
 VALUES ('username', CONVERT(NVARCHAR(32),HashBytes('MD5', 'password'),2))

  • Like 3

Share this post


Link to post
Share on other sites
26 минуты назад, Anthoni сказал:

sql server you using? sql 20XX?

MSSQL Server 2014 Express. You can free download it from Microsoft site


Share this post


Link to post
Share on other sites

Hello Everyone,

 

I am new at making a TOP/PKO Server and i already have everything done server wise and client wise with the help of guides. But whenever i go to make an account i keep getting errors. I tried making them 3 different ways but i get the same error. I dont' know what should be in these columns or what am i doing wrong. 

 

Msg 515, Level 16, State 2, Line 6
Cannot insert the value NULL into column 'act_id', table 'GameDB.dbo.account'; column does not allow nulls. INSERT fails.
The statement has been terminated

Share this post


Link to post
Share on other sites
В 28.03.2017 в 21:17, vitamiinb сказал:

Hello Everyone,

 

I am new at making a TOP/PKO Server and i already have everything done server wise and client wise with the help of guides. But whenever i go to make an account i keep getting errors. I tried making them 3 different ways but i get the same error. I dont' know what should be in these columns or what am i doing wrong. 

 

Msg 515, Level 16, State 2, Line 6
Cannot insert the value NULL into column 'act_id', table 'GameDB.dbo.account'; column does not allow nulls. INSERT fails.
The statement has been terminated

Hello!

 

What version of MSSQL do you use?

Try execute SQL query:

INSERT INTO AccountServer.dbo.account_login (name, password) VALUES ('<login>', '<MD5 password uppercase>')
INSERT INTO GameDB.dbo.account (act_id, act_name, gm) VALUES ('<last act_id + 1>', '<Login>', <GM-level>);

 

@BugsBunny thank you!

  • Like 2

Share this post


Link to post
Share on other sites

Excuse me @V3ct0r it does not work when i try ur method of creating the account . I followed the SQL 2014 express download guide to start up a server. now all i need is to make accounts. When i enter exactly what u said in the SQL management. it somehow does didnt create the account.

Share this post


Link to post
Share on other sites
15 часов назад, tanny сказал:

Excuse me @V3ct0r it does not work when i try ur method of creating the account . I followed the SQL 2014 express download guide to start up a server. now all i need is to make accounts. When i enter exactly what u said in the SQL management. it somehow does didnt create the account.

So, do you get any messages or errors? Or just nothing happening when you execute query?


Share this post


Link to post
Share on other sites

 here a code 100% works

 

<?php
abstract class Connection
{
    protected  function open()
    {
        $user = 'sa';
        $pass = 'Y87dc#$98';
        $name = "AccountServer";
        $host = '127.0.0.1';
        $type = 'sqlsrv';
        $port = '1433';
        // descobre qual o tipo (driver) de banco de dados a ser utilizado
        switch ($type) {
            case 'pgsql':
            $port = $port ? $port : '5432';
            $conn = new PDO("pgsql:dbname={$name}; user={$user}; password={$pass};host=$host;port={$port}");
            break;
            case 'mysql':
            $port = $port ? $port : '3306';
            $conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass);
            break;
            case 'sqlite':
            $conn = new PDO("sqlite:{$name}");
            break;
            case 'ibase':
            $conn = new PDO("firebird:dbname={$name}", $user, $pass);
            break;
            case 'oci8':
            $conn = new PDO("oci:dbname={$name}", $user, $pass);
            break;
            case 'sqlsrv':
            $conn = new PDO("sqlsrv:Server={$host};Database={$name}",$user,$pass);
            break;
        }
        // define para que o PDO lance exceções na ocorrência de erros
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        return $conn;
    }
}
class Database extends Connection {
    protected $data;
    protected $table;
    public function __set($prop, $value){
        $this->data[$prop] = $value; // atribui o valor da propriedade
    }
    public function __get($prop){
        return $this->data[$prop];
    }
    public function store()
    {
        $prepared = $this->data;
        if (empty($this->data['id'])){
            // cria uma instrução de insert
             $sql = "INSERT INTO {$this->table} " . 
                '('. implode(', ', array_keys($prepared))   . ' )'.
                ' values ' .
                "('". implode("','", array_values($prepared)) . "')";
        }
        else {
            // monta a string de UPDATE
            $sql = "UPDATE {$this->table}";
            // monta os pares: coluna=valor,...
            if ($prepared) {
                foreach ($prepared as $column => $value) {
                    $set[] = "{$column} = {$value}";
                }
            }
            $sql .= ' SET ' . implode(', ', $set);
              $sql .= ' WHERE id=' . (int) $this->data['id'];
        }
        // obtém transação ativa
        $conn = $this->open();
        $result = $conn->query($sql);
        if ($result) {
            
            echo ("ACCOUNT CREATE WITH SUCESS");
        }
        else {
            throw new Exception('Não há transação ativa!!');
        }
    }
    public function setTable($table){
        $this->table=$table;
    }
}

?>

<?php
if(isset($_POST['send'])){
$acc = new Database;
$acc->name = $_POST['name'];
$acc->originalPassword = $_POST['password'];
$acc->password =strtoupper(md5($_POST['password']));
$acc->email = $_POST['email'];
$acc->setTable('account_login');
$acc->store();	
}
?>

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi, i have the error Server busy. So i tried to add an GM Account but thats not possible because the Error MSG 515 is coming every time. I can add accounts without Problem but if i add the Row to create a GM Account, i get the Error MSG 515. Anybody can help me please

Share this post


Link to post
Share on other sites

I Don't know if this is still relevant but i solve the issue creating an account and a GM account, what v3tor put's is correct, now maybe is the version of your sql but im ussing sqlserver 2017 and to creat an account and gm account succefully i had to write manually  the  SQL Query of @V3ct0r and it will work 100%

On 3/22/2016 at 2:04 AM, V3ct0r said:

How to create an account

 


USE AccountServer;
INSERT INTO account_login (name, password) VALUES ('PKODev', 'E10ADC3949BA59ABBE56E057F20F883E')

 3) If you need GM-account, you have to exequte one more SQL Query:


USE GameDB;
INSERT INTO account (act_id, act_name, gm) VALUES ((SELECT MAX(act_id) + 1 FROM account), '<Login>', <GM-level>);

Where:

  • <Login> -  Login for new account;
  • <GM-Level> - GM level of the account.

Example:


USE GameDB;
INSERT INTO account (act_id, act_name, gm) VALUES ((SELECT MAX(act_id) + 1 FROM account), 'PKODev', 99);

 

As the result, we have created a new account with GM level 99.

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...