Fuzzie's Account System v3

Started by Fuzzie, Jan 24, 2015, 08:00 AM

Previous topic - Next topic

Fuzzie

Fuzzie's Account System v3


Ever since 0.4 came out, I knew I had to update my account system that I made for the 0.3z R2 Squirrel server. I also knew that I had to do more than just edit a few lines of code. I had to create an entire new one to support server owners who wants to use the MySQL plugin. I tried to make the difference between both variants as small as possible although several external factors such as connection speed may cause varying experience.



SQLite Variant

Nothing much was changed from the previous version.

Required Plugins: Squirrel, SQLite and Hashing

This zip archive contains the SQLite variant (fas_v3_sqlite.nut), a sample SQL query text file, and a sample script.

Download via MediaFire



MySQL Variant

Specifically made for server owners and coders who uses a MySQL database.

Required Plugins: Squirrel, MySQL and Hashing

This zip archive contains the MySQL variant (fas_v3_mysql.nut), a sample SQL query text file, and a sample script.

Download via MediaFire

Note: When connecting to a MySQL database that is not located locally (localhost), you may need to whitelist your server IP to allow it to remotely access your database. Click here for more info.



Both of these variants have the same functions with the same parameters

PlayerClass(playerName, dbGlobal)
PlayerClass.Join(player)
PlayerClass.Update(player, dbGlobal)
PlayerClass.Register(player, password, dbGlobal)
PlayerClass.Login(player, password, dbGlobal)

*dbGlobal is an SQLite or MySQL database pointer. Refer to the sample script (main.nut) for further information.



If you found any bugs, feel free to post it and I will try to fix as soon as possible.

Happy coding!


Sebastian

Sounds'n'looks good at a first view. Good job ;)

Fuzzie

Thanks. I have definitely spotted a few places where I can improve it but that will come in the next version which will probably be a few months away depending on how well this one is.

MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

PsyChO_KiLLeR

GETTING ERROR Here


My pic uploader software not working so i give here lines


 this is of fas_v3_sqlite line 56

::QuerySQL( dbGlobal, "INSERT INTO Accounts VALUES('" + player.Name + "', '" + player.Name.tolower() + "', '" + ::SHA256( password ) + "', 0, 0, 0, 0, 1, '" + player.IP + "')" ); 





and error here
this is line of main.nut 156
   pstats[ player.ID ].Register( player, text, sqliteDB );

.

.

PsyChO_KiLLeR

oh thank u so much slc
my problem solve

Kratos_

Quote from: Squirrel Master on Feb 28, 2015, 04:13 AM::QuerySQL( dbGlobal, "INSERT INTO Accounts VALUES('" + player.Name + "', '" + player.Name.tolower() + "', '" + ::SHA256( password ) + "', 0, 0, 0, 0, 1, '" + player.IP + "')" ); 


Considering high-end cryptographic security, WHIRLPOOL is preferred over SHA256 . If the scripts are being updated to the newer 0.4 version then people should utilize the more secure hashing algorithm available to them as well.
In the middle of chaos , lies opportunity.

.

Quote from: Kratos_ on Feb 28, 2015, 05:54 AMConsidering high-end cryptographic security, WHIRLPOOL is preferred over SHA256 . If the scripts are being updated to the newer 0.4 version then people should utilize the more secure hashing algorithm available to them as well.

Also consider using a salt if we're on the subject of security :)
.

Kratos_

#10
Quote from: S.L.C on Feb 28, 2015, 06:00 AMAlso consider using a salt if we're on the subject of security :)

Yes. A hashing algorithm ( WHIRLPOOL ) with a random salt combination will be secure enough, at least in VC:MP. :)
In the middle of chaos , lies opportunity.

Ksna

#11
Sorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.

Fixed Code
if( cmd == "register" ){
if( !text ){
MessagePlayer( "Syntax Error!", player );
MessagePlayer( "Correct syntax: /register <password>", player );
}
else if( pstats[ player.ID ].Level != 0 )MessagePlayer( " This account is already Registered", player );
else if( pstats[ player.ID ].Logged == true ){
MessagePlayer( "You are already logged in.", player );
}
else{
pstats[ player.ID ].Register( player, text, sqliteDB );
}
}


MacTavish

Quote from: Ksna on Jul 11, 2015, 07:41 AMSorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.
if( cmd == "register" ){
if( !text ){
MessagePlayer( "Syntax Error!", player );
MessagePlayer( "Correct syntax: /register <password>", player );
}
else if( pstats[ player.ID ].Level != 0 )MessagePlayer( " This account is already Registered", player );
else if( pstats[ player.ID ].Logged == true ){
MessagePlayer( "You are already logged in.", player );
}
else{
pstats[ player.ID ].Register( player, text, sqliteDB );
}
}

Because table isnt created in database

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Ksna

#13
Quote from: Beztone on Jul 11, 2015, 07:44 AMBecause table isnt created in database
I  just showed a bug  and how to fix... and i said if player is not automatically logged.

[VSS]Shawn

You Might Modify That System