[GameMode] Very Basic Script
#25

Quote:
Originally Posted by Calisthenics
View Post
Linux is, it will return error for table not found.

https://dev.mysql.com/doc/refman/8.0...nsitivity.html




About users.sql
1) Set `Name` column as UNIQUE KEY.
2) Bcrypt returns 60 characters but you used VARCHAR(255). Length is fixed so better use CHAR(60)
3) Column `Level` is misleading.
4) When a value of column is always between a small range, use different type of integer (MEDIUMINT, SMALLINT, TINYINT)

About Base.pwn
1) Standalone foreach is very outdated, YSI 5 and y_iterate.
2) Pass handle parameter in mysql_errno function because if a filterscript uses mysql and no duplicated connections, it will use handle 1 as default.
3) In OnPlayerConnect, you select all just to see if there are rows. Either COUNT() aggregate function or select password and id there and not in dialog response.
4)
pawn Code:
mysql_tquery(handle, query, "OnPlayerLogin", "ds", playerid, inputtext);
If log level is set as ALL, it will log password as plain text in mysql.log file.
5)
pawn Code:
"SELECT password, Master_ID from `USERS` WHERE Name LIKE '%s'"
Remove LIKE keyword.
6) Be consistent about table and column names. Read my reply to GeorgeMcReary as a reference.
7) `MasterID` column is PRIMARY KEY, LIMIT keyword is obsolete.
8 ) Check against race condition.
A) Why did I use 255 Chars? To make it future proof. In documentation of PHP's password_hash(), they said that its better to use 255 characters because password_default changes its value to the strongest hashing available in PHP. Most users use password_default while using PHP. So, in case they create a UCP and use password_default and something better than bcrypt comes up, 255 will make it future proof. User will not have to make any changes to his database.

Quote:

Note that this constant is designed to change over time as new and stronger algorithms are added to PHP. For that reason, the length of the result from using this identifier can change over time. Therefore, it is recommended to store the result in a database column that can expand beyond 60 characters (255 characters would be a good choice).
B) Column Level is fine by me. If people want to use other names like score or something, they can.

C) I used standalone foreach because I didnt want to include whole YSI just so I can use one function from it. When people start using this, they can update on their preference or can continue using standalone..

D) What do you mean by race condition?

Other changes have been done in gamemode and database. Files uploaded. Thanks..!
Reply


Messages In This Thread
Very Basic Script - by GTLS - 23.07.2019, 16:55
Re: Very Basic Script - by N4Sti - 23.07.2019, 17:22
Re: Very Basic Script - by ZigGamerx - 23.07.2019, 17:26
Re: Very Basic Script - by NeXTGoD - 23.07.2019, 18:04
Re: Very Basic Script - by GTLS - 24.07.2019, 04:06
Re: Very Basic Script - by ZigGamerx - 24.07.2019, 09:18
Re: Very Basic Script - by GTLS - 24.07.2019, 10:04
Re: Very Basic Script - by GeorgeMcReary - 24.07.2019, 10:20
Re: Very Basic Script - by Mobtiesgangsa - 24.07.2019, 19:59
Re: Very Basic Script - by Kane - 24.07.2019, 21:18
Re: Very Basic Script - by kukboy - 24.07.2019, 21:48
Re: Very Basic Script - by Josh_Main - 25.07.2019, 08:59
Re: Very Basic Script - by GTLS - 25.07.2019, 09:23
Re: Very Basic Script - by Huemerson - 25.07.2019, 12:49
Re: Very Basic Script - by sonn51280 - 25.07.2019, 13:10
Re: Very Basic Script - by ZigGamerx - 25.07.2019, 14:02
Re: Very Basic Script - by GTLS - 27.07.2019, 09:23
Re: Very Basic Script - by PhantomThief1412 - 04.08.2019, 14:36
Re: Very Basic Script - by ZigGamerx - 04.08.2019, 18:39
Re: Very Basic Script - by SiaReyes - 05.08.2019, 13:20
Re: Very Basic Script - by GeorgeMcReary - 05.08.2019, 16:09
Re: Very Basic Script - by GTLS - 05.08.2019, 16:27
Re: Very Basic Script - by SiaReyes - 05.08.2019, 16:35
Re: Very Basic Script - by Calisthenics - 05.08.2019, 17:16
Re: Very Basic Script - by GTLS - 06.08.2019, 06:59
Re: Very Basic Script - by Calisthenics - 06.08.2019, 08:04
Re: Very Basic Script - by GTLS - 06.08.2019, 08:58
Re: Very Basic Script - by Calisthenics - 06.08.2019, 11:59
Re: Very Basic Script - by GTLS - 07.08.2019, 16:47
Re: Very Basic Script - by Mugala - 08.08.2019, 23:21

Forum Jump:


Users browsing this thread: 2 Guest(s)