This is a snippet from a --very old-- php program (used by my school) to search events in a database. I barely know php, so I'm sorry if this question is very obvious, but this part of the program seems very insecure to me. Am I missing something that is preventing SQL injection here? Are the strtolower or the "%" around the search text a security measure or do they have another function?
$strSuchtext='%' . strtolower($strSuchbegriff) . '%';
$strSQL="SELECT DISTINCT tuv.uv_id,tuv.fach_id,
tuv.stufe_id,tuv.kursart_id,tuv.zug_id
FROM $strGtabEinUnterrichtsvorhaben AS tuv
WHERE (tuv.schulform_id=$numSF_ID)
AND (LOWER(tuv.uv_titel) LIKE '$strSuchtext' )
$strCond";
$stmtSQL = db_exec($strSQL,$boolDEBUG);
"$strSuchtext" is so far unchanged, unfiltered user input. here is the whole code, in case i didn't copy something important: https://pastebin.com/Fjy8b50V