mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 08:01:27 +00:00
Added PrepForSQL function (#914)
performs a check to a string with expected patterns to be matched.
This commit is contained in:
@@ -414,3 +414,15 @@ end
|
||||
function QBCore.Functions.Notify(source, text, type, length)
|
||||
TriggerClientEvent('QBCore:Notify', source, text, type, length)
|
||||
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
|
||||
Reference in New Issue
Block a user