1
0
Fork 0
forked from bton/matekasse
This commit is contained in:
root 2023-05-31 19:23:40 +00:00
parent 9145ede016
commit 3df799a491

11
main.py
View file

@ -7,7 +7,7 @@ import atexit
import sys
db_path = 'mate.db'
conn = sqlite3.connect(db_path)
conn = sqlite3.connect(db_path, check_same_thread=False)
c = conn.cursor()
app = Flask(__name__)
@ -54,13 +54,13 @@ def new_user():
@app.route("/adduser/user", methods=['GET'])
def adduser():
user = request.args.get("username")
c.execute(f"SELECT * FROM users WHERE username='{str(user)}'")
c.execute(f"SELECT * FROM users WHERE username='{str(user)}'")
if c.fetchall() == []:
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES ('%s', 0)" % user)
conn.commit()
return "alert('Added userd')"
return 'Added user <a href="/list">user and tag list</a> <p>The creator of this website accepts no liability for any linguistic or technical errors!</p>'
else:
return "alert('User already exists')"
return 'User already exists <a href="/list">user and tag list</a> <p>The creator of this website accepts no liability for any linguistic or technical errors!</p>'
@app.route("/change", methods=['GET'])
@ -142,4 +142,5 @@ def get_id():
def main():
atexit.register(exit_handler)
socketio.run(app)
socketio.run(app, host='0.0.0.0', port=5000)