Fuzzie's Account System v3

Fuzzie

  • Jr. Member
  • Posts: 83
Fuzzie's Account System v3
« on January 24th, 2015, 08:00 AM »Last edited on January 24th, 2015, 08:03 AM
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!

BigcaT_

  • Guest

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 917

Fuzzie

  • Jr. Member
  • Posts: 83
Re: Fuzzie's Account System v3
« Reply #3, on January 24th, 2015, 12:37 PM »
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

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 444
Code: [Select]
if( !sucess ) tryAgain();

PsyChO_KiLLeR

  • Full Member
  • Learning from you All
  • Posts: 133
Re: Fuzzie's Account System v3
« Reply #5, on February 28th, 2015, 04:13 AM »
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 );

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
.

PsyChO_KiLLeR

  • Full Member
  • Learning from you All
  • Posts: 133

Kratos_

  • Jr. Member
  • Mutaros Apotheoses
  • Posts: 86
Re: Fuzzie's Account System v3
« Reply #8, on February 28th, 2015, 05:54 AM »
Quote from Squirrel Master on February 28th, 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.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Fuzzie's Account System v3
« Reply #9, on February 28th, 2015, 06:00 AM »
Quote from Kratos_ on February 28th, 2015, 05:54 AM
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.
Also consider using a salt if we're on the subject of security :)
.

Kratos_

  • Jr. Member
  • Mutaros Apotheoses
  • Posts: 86
Re: Fuzzie's Account System v3
« Reply #10, on February 28th, 2015, 06:11 AM »Last edited on February 28th, 2015, 06:13 AM
Quote from S.L.C on February 28th, 2015, 06:00 AM
Also 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

  • Jr. Member
  • Posts: 86
Re: Fuzzie's Account System v3
« Reply #11, on July 11th, 2015, 08:41 AM »Last edited on July 11th, 2015, 08:44 AM
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
Code: [Select]
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

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809
Re: Fuzzie's Account System v3
« Reply #12, on July 11th, 2015, 08:44 AM »
Quote from Ksna on July 11th, 2015, 08:41 AM
Sorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.
Code: [Select]
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

  • Jr. Member
  • Posts: 86
Re: Fuzzie's Account System v3
« Reply #13, on July 11th, 2015, 09:03 AM »Last edited on July 11th, 2015, 09:06 AM
Quote from Beztone on July 11th, 2015, 08:44 AM
Because 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

  • Full Member
  • Posts: 210