@app.route("/users/<userid>", methods=["GET", "POST"])
def user(userid):
if not "id" in session:
return redirect("/login")
if request.method == "GET":
user_info = fc.guild_user(session["id"], userid)
if user_info == None:
abort(404)
return render_template("user.html", user=user_info)
else:
user_info = fc.guild_user(session["id"], userid)
if user_info == None:
abort(404)
form = request.form
if not "balance" in form:
abort(400)
if not form["balance"].isdigit():
Return "Please enter the balance as a number only."
if not (0 < int(form["balance"]) <= 10000000):
Return "You can enter up to 10 million won in balance."
con,cur = fc.start_db(session["id"])
cur.execute("UPDATE users SET balance = ? WHERE id == ?;", (form["balance"], userid))
con.commit()
con.close()
return "ok"
When you see it on the site, if you enter 0 and save it, that error appears.
I only get the sauce. I don't know how to do it.
Of course, entering 0
will cause an "error". That's how the cord looks like that's what it looks like. If you don't want to see that "error," you can fix it as below.
if not (0 <= int(form["balance"]) <= 10000000):
However, the process of "modifying the balance 0
won" is a bit dangerous, so think about whether it is really right in terms of service planning and apply it.
© 2024 OneMinuteCode. All rights reserved.