Added log for add user
This commit is contained in:
parent
df320bea8b
commit
3dcc985087
1 changed files with 6 additions and 3 deletions
9
main.py
9
main.py
|
@ -123,12 +123,15 @@ def remove_user():
|
|||
|
||||
@app.route("/adduser/user", methods=['GET'])
|
||||
def adduser():
|
||||
user = request.args.get("username")
|
||||
c.execute("SELECT * FROM users WHERE username=?", [user])
|
||||
username = request.args.get("username")
|
||||
c.execute("SELECT * FROM users WHERE username=?", [username])
|
||||
if c.fetchall() == []:
|
||||
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [user])
|
||||
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [username])
|
||||
conn.commit()
|
||||
socketio.emit("update", "update")
|
||||
c.execute(f"SELECT * FROM users WHERE username={username}")
|
||||
user = c.fetchall()[0]
|
||||
db_log(f"Added user id: {user[0]} name: {user[2]}")
|
||||
return 'Added user <a href="/list">user and tag list</a>'
|
||||
else:
|
||||
return '<p>Error: 170</p> <a href="/list">user and tag list</a>'
|
||||
|
|
Loading…
Reference in a new issue