register problem

Started by Cool, Apr 23, 2016, 10:15 AM

Previous topic - Next topic

Cool

one name player can be register twice time and its add double time in db
its problem due to lower alphabets and bigger if a player registered with bangash he can register again with BANGASH
constructor( playerName, dbGlobal ){
local query = ::QuerySQL( dbGlobal, "SELECT Cash, Bank, Kills, Deaths, Level, LastUsedIP, nogoto FROM Accounts WHERE Name='" + playerName + "' AND NameLower='" + playerName.tolower() + "'" );
if( ::GetSQLColumnData( query, 5 ) ){
Cash = ::GetSQLColumnData( query, 0 );
Bank = ::GetSQLColumnData( query, 1 );
Kills = ::GetSQLColumnData( query, 2 );
Deaths = ::GetSQLColumnData( query, 3 );
Level = ::GetSQLColumnData( query, 4 );
LastUsedIP = ::GetSQLColumnData( query, 5 );
}
::FreeSQLQuery( query );
}

function Join( player ){
if( Level == 0 ){
::MessagePlayer("[#FF0000][TIP][#FFFFFF]   Please Register To Play.", player );
::MessagePlayer( "[#FF0000][INFO][#FFFFFF]Register with /register <password>", player );
}
else if( LastUsedIP == player.IP ){
Logged = true;
::MessagePlayer( "[#FF0000] [SERVER] [#FFFFFF]Welcome back !", player );
::MessagePlayer( "[#FF0000] [SERVER] [#FFFFFF]You have been auto logged in server !", player );
}
else{
::MessagePlayer( "[#FF0000] [Tip] [#FFFFFF]Please login to play.", player );
::MessagePlayer( "[#FF0000] [INFO] [#FFFFFF]Login with /login <password>", player );
}
}

function Update( player, dbGlobal ){
::QuerySQL( dbGlobal, "UPDATE Accounts SET Cash=" + Cash + ", Bank=" + Bank + ", Kills=" + Kills + ", Deaths=" + Deaths + ", Level=" + Level + ", LastUsedIP='" + LastUsedIP + ", nogoto='" + nogoto + "' WHERE Name='" + player.Name + "' AND NameLower='" + player.Name.tolower() + "'" );
}

function Register( player, password, dbGlobal ){
::QuerySQL( dbGlobal, "INSERT INTO Accounts VALUES('" + player.Name + "', '" + player.Name.tolower() + "', '" + ::SHA256( password ) + "', 0, 0, 0, 0, 1, '" + player.IP + "', '" + 0 + "')" );
Level = 1;
LastUsedIP = player.IP;
Logged = true;
::MessagePlayer( "[#FF0000] [Info] [#FFFFFF]Successfully registered.", player );
::MessagePlayer( "[#FF0000] [Tip] [#FFFFFF]Don't forget your password. [" + password + "]", player );
}


function Login( player, password, dbGlobal ){
local query = ::QuerySQL( dbGlobal, "SELECT Password FROM Accounts WHERE Name='" + player.Name + "' AND NameLower='" + player.Name.tolower() + "'" );
if( ::GetSQLColumnData( query, 0 ) == null ){
::MessagePlayer( "[#FF0000][TIP] [#FFFFFF] You are not registered Register With /register pass.", player );
}
else if( ::SHA256( password ) != ::GetSQLColumnData( query, 0 ) ){
::MessagePlayer( "[#FF0000] [Info] [#FFFFFF]Wrong password.", player );
}
else{
LastUsedIP = player.IP;
Logged = true;
::MessagePlayer( "[#FF0000] [Info] [#FFFFFF]Successfully logged in.", player );
}
}
}

.

I'm sorry but what does 'prob' mean? Does it stand for 'problem'? If so, then spell the whole f*ing name because no one will be able to search for similar issues if you f*tards can't spell correctly.
.

Cool

thanks for telling me my mistake

KAKAN

Quote from: . on Apr 23, 2016, 10:22 AMI'm sorry but what does 'prob' mean? Does it stand for 'problem'? If so, then spell the whole f*ing name because no one will be able to search for similar issues if you f*tards can't spell correctly.
Quote from: Hercules on Apr 23, 2016, 10:29 AMthanks for telling me my mistake
You're welcome lol
For 'you', the 'fix' to your 'problem' is:
Remove the NAME from the queries and only use/keep the NameLower :D
oh no

Cool

#4
 [EDIT]I try but bugging my script as you know w i am exprience less local query = ::QuerySQL( dbGlobal, "SELECT Cash, Bank, Kills, Deaths, Level, LastUsedIP, nogoto FROM Accounts WHERE Name='"+NameLower='" + playerName.tolower() + "'" );


KAKAN

Use this:
local query = ::QuerySQL( dbGlobal, "SELECT Cash, Bank, Kills, Deaths, Level, LastUsedIP, nogoto FROM Accounts WHERE NameLower='" + playerName.tolower() + "'" );
oh no

Cool


Cool

#7
At that time problem is solved but now occurring again please help

KAKAN

Quote from: Hercules on Apr 24, 2016, 07:41 PMAt that time problem is solved but now occurring again please help
What's the error?

Quote from: Hercules on Apr 23, 2016, 11:56 AM@KAKAN love you
gay
oh no

Cool

its problem due to lower alphabets and bigger if a player registered with bangash he can register again with BANGASH
Quote from: Hercules on Apr 23, 2016, 11:56 AM@KAKAN love you
gay
[/quote]
NOT gay lol

Coolkid

#10
Can you show you function onPlayer Join

local query = ::QuerySQL( dbGlobal, "SELECT Password FROM Accounts WHERE Name LIKE '" + player.Name + "' '" )

Try this note I am on mobile so thee might be mistake

LIKE works as same way as player.Name.tolower

Cool

function onPlayerJoin( player ){
NewTimer("Banned", 3000, 1, player.ID );
NewTimer("Jailed", 3000, 1, player.ID );

local country = geoip_country_name_by_addr(player.IP);
    if (country != null) // the plugin returned a meaningful result
        Message("* " + player.Name + " is connecting from " + country + ". [" + geoip_country_code_by_addr(player.IP) + "]");


pstats[ player.ID ] = PlayerClass( player.Name, sqliteDB );
 pstats[ player.ID ].Join( player );
 AddUser( player );
 menuJoin( player );
 tuneJoin( player );
 if(timer_status == false)
                {
                        timer_status = true;
                        meter.Paused = false;
                        print("Timer Resumed");
NewTimer("sendmsgs", 100000, 0 );

                }
}

Coolkid

Did you tried local query = ::QuerySQL( dbGlobal, "SELECT Password FROM Accounts WHERE Name LIKE '" + player.Name + "' '" )

Coolkid

#13
Try this also local query = ::QuerySQL( dbGlobal, "SELECT Cash, Bank, Kills, Deaths, Level, LastUsedIP, nogoto FROM Accounts WHERE Name LIKE '" + playerName+ "'" );

Cool

#14
now not showing that i am not registered but when i try to login its shows you are not registered with us and i can register again  @KAKAN  HELP