Added PrepForSQL function (#914)

performs a check to a string with expected patterns to be matched.
This commit is contained in:
R0adRa93
2023-01-17 10:01:36 -05:00
committed by GitHub
parent 33979cbede
commit 9878aeaeb2
+12
View File
@@ -414,3 +414,15 @@ end
function QBCore.Functions.Notify(source, text, type, length) function QBCore.Functions.Notify(source, text, type, length)
TriggerClientEvent('QBCore:Notify', source, text, type, length) TriggerClientEvent('QBCore:Notify', source, text, type, length)
end end
--- SQL Pattern Matching
function QBCore.Functions.PrepForSQL(source,data,pattern)
local src = source
local player = QBCore.Functions.GetPlayer(src)
local result = string.match(data, pattern)
if not result or string.len(result) ~= string.len(data) then
TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'SQL Injection Attempted', 'red', string.format('%s Attempted a SQL Exploit!', player.PlayerData.license))
return false
end
return true
end