fixed error in /remove user
This commit is contained in:
parent
fda2fb6ffd
commit
6500962dc4
1 changed files with 7 additions and 5 deletions
12
main.py
12
main.py
|
@ -46,11 +46,11 @@ def list():
|
|||
|
||||
@app.route("/list/user", methods=['GET'])
|
||||
def user_info():
|
||||
username = '%s' % request.args.get("user")
|
||||
username = request.args.get("user")
|
||||
c.execute("SELECT * FROM users WHERE username = '%s'" % username)
|
||||
user = c.fetchall()
|
||||
if user != []:
|
||||
user[0]
|
||||
user_list = c.fetchall()
|
||||
if user_list != []:
|
||||
user = user_list[0]
|
||||
c.execute(f"SELECT * FROM tags WHERE userid={user[0]}")
|
||||
tags = c.fetchall()
|
||||
text = ""
|
||||
|
@ -66,7 +66,9 @@ def new_user():
|
|||
|
||||
@app.route("/removeuser", methods=['GET'])
|
||||
def remove_user():
|
||||
user_id = '%s' % request.args.get("id")
|
||||
user_name = request.args.get("id")
|
||||
c.execute("SELECT * FROM users WHERE username = '%s'" % user_name)
|
||||
user_id = c.fetchall()[0][0]
|
||||
c.execute(f"DELETE * FROM tags WHERE userid={user_id}") #Noch eine Bestätigung nötig
|
||||
c.execute(f"DELETE * FROM users WHERE id={user_id}")
|
||||
conn.commit()
|
||||
|
|
Loading…
Reference in a new issue