Skip to content
Snippets Groups Projects
Commit 25f3b0a6 authored by Oskari Lahtinen's avatar Oskari Lahtinen :speech_balloon:
Browse files

SQL-injektioesimerkki

parent 3c3a2956
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,9 @@ for paiva in data["MenusForDays"]:
if len(ruoka['Components']) != 0:
# yhdistetään ruokavaihtoehdon eri komponentit
ruokastring = ' '.join(ruoka['Components'])
# EI näin, SQL injection:
#stmt = f"INSERT INTO ateria (paiva, ruoka) VALUES({pvm}, {ruokastring})"
#cur.execute(stmt)
cur.execute("INSERT INTO ateria (paiva, ruoka) VALUES(?, ?)", (pvm, ruokastring))
con.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment