Register Problem

Started by imran, Jun 24, 2015, 07:34 PM

Previous topic - Next topic

imran

My registration function is bugged.It shows no error but when i rejoin server it asks me to register again.
- Link removed -

Thijn

Post your registration code. On the forum, not one some dodgy file uploading site.

imran

function register(player,text)
{
QuerySQL( db, "INSERT INTO Accounts (Name,Password,Level,RegisterDate,LastLogin,Cash,Bank,IP,Country) values( '"+player.Name+"','"+text+"','1', '"+GetFullTime()+"', '"+GetFullTime()+"','2000','0','"+player.IP+"','"+IpToCountry( player.IP )+"','0','0','0','0','0','0','0','0')");
QuerySQL( db, "INSERT INTO KD ( Name,Kills,Deaths) VALUES ( '" + player.Name +"','0','0' )" );
player.Cash = 2000
}
if ( cmd == "register" )
{
                 local q = QuerySQL( db, "SELECT * FROM Accounts WHERE rowid LIKE '" + text + "'" );
if ( binfo[player.ID].registered==true ) MessagePlayer("[#FF0000]Error:[#F7FE2E]You Are Already Registered"player);
                 else
{
                if ( text )
              {
MessagePlayer("[#F7FE2E]You have registered your nickname, Password - " + text, player);
register(player,text);
                      binfo[player.ID].registered=true;
binfo[player.ID].logged=true;
       
}
else MessagePlayer( "[#FF0000]Usage: [#F7FE2E]/" + cmd + " <Password>", player );
}
}
function onScriptLoad()
{
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Accounts ( Name VARCHAR(32),Password VARCHAR(25),Level VARCHAR(32), RegisterDate TEXT, LastLogin TEXT,Cash INT(15),Bank INT(15),IP VARCHAR(25),Country VARCHAR(25))" );
}

vcmptr

#3
Quote from: imran on Jun 24, 2015, 08:04 PMfunction register(player,text)
{
QuerySQL( db, "INSERT INTO Accounts (Name,Password,Level,RegisterDate,LastLogin,Cash,Bank,IP,Country) values( '"+player.Name+"','"+text+"','1', '"+GetFullTime()+"', '"+GetFullTime()+"','2000','0','"+player.IP+"','"+IpToCountry( player.IP )+"','0','0','0','0','0','0','0','0')");
QuerySQL( db, "INSERT INTO KD ( Name,Kills,Deaths) VALUES ( '" + player.Name +"','0','0' )" );
player.Cash = 2000
}
if ( cmd == "register" )
{
                 local q = QuerySQL( db, "SELECT * FROM Accounts WHERE rowid LIKE '" + text + "'" );
if ( binfo[player.ID].registered==true ) MessagePlayer("[#FF0000]Error:[#F7FE2E]You Are Already Registered"player);
                 else
{
                if ( text )
              {
MessagePlayer("[#F7FE2E]You have registered your nickname, Password - " + text, player);
register(player,text);
                      binfo[player.ID].registered=true;
binfo[player.ID].logged=true;
       
}
else MessagePlayer( "[#FF0000]Usage: [#F7FE2E]/" + cmd + " <Password>", player );
}
}
function onScriptLoad()
{
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Accounts ( Name VARCHAR(32),Password VARCHAR(25),Level VARCHAR(32), RegisterDate TEXT, LastLogin TEXT,Cash INT(15),Bank INT(15),IP VARCHAR(25),Country VARCHAR(25))" );
}
I think your SQL query wrong.
My English is not good.

Stormeus

Your SQL is definitely wrong.
INSERT INTO Accounts (Name,Password,Level,RegisterDate,LastLogin,Cash,Bank,IP,Country) values( '"+player.Name+"','"+text+"','1', '"+GetFullTime()+"', '"+GetFullTime()+"','2000','0','"+player.IP+"','"+IpToCountry( player.IP )+"','0','0','0','0','0','0','0','0')

How are you inserting 17 values when specifying 9 columns?

[VSS]Shawn

#5
Why I AM Thinking That is VCCNR?

imran

Thanks my problem is solved :)