This fix will not work.
PHP Code:
IF (SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [account] = @iaccount AND [serverindex] = @iserverindex) = 'F'
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
What would happen if
PHP Code:
SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [account] = @iaccount AND [serverindex] = @iserverindex
returned multiple entries?(multiple characters deleted on that slot)
It would return the first entry('D'), bypassing your check.
Try:
PHP Code:
IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [account] = @iaccount AND [playerslot] = @iplayerslot AND [serverindex] = @iserverindex AND [isblock] = 'F')
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
[Strike]I also ommitted "[account] = @iaccount", because it's inefficient(strcmp on non-indexed field is resource intensive) and redundant.[/Strike]
- Edited: checking account field is necessary, my bad.