fixed splite injektion
This commit is contained in:
parent
6ec799b632
commit
e8cdf4acb2
2 changed files with 6 additions and 3 deletions
8
main.py
8
main.py
|
@ -8,6 +8,7 @@ import atexit
|
|||
import sys
|
||||
import uuid
|
||||
import json
|
||||
import urllib.parse
|
||||
|
||||
db_path = 'mate.db'
|
||||
conn = sqlite3.connect(db_path, check_same_thread=False)
|
||||
|
@ -42,7 +43,8 @@ def list():
|
|||
users = c.fetchall()
|
||||
text = ""
|
||||
for i in users:
|
||||
text = text + f'<p><a href="list/user?user={i[1]}">{i[1]}</a>: {i[2]} <form action="/change" method="get"><input name="id" type="hidden" value="{i[0]}"> Change balance: <input name="change"><input type="submit"></form></p> <br style="line-height: 50%;"></br>'
|
||||
username = urllib.parse.quote_plus(i[1])
|
||||
text = text + f'<p><a href="list/user?user={username}">{i[1]}</a>: {i[2]} <form action="/change" method="get"><input name="id" type="hidden" value="{i[0]}"> Change balance: <input name="change"><input type="submit"></form></p> <br style="line-height: 50%;"></br>'
|
||||
return '''<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
|
||||
|
@ -59,7 +61,7 @@ def list():
|
|||
|
||||
@app.route("/list/user", methods=['GET'])
|
||||
def user_info():
|
||||
username = request.args.get("user")
|
||||
username = urllib.parse.unquote_plus(request.args.get("user"))
|
||||
c.execute("SELECT * FROM users WHERE username = ?", [username])
|
||||
user_list = c.fetchall()
|
||||
if user_list != []:
|
||||
|
@ -119,7 +121,7 @@ def adduser():
|
|||
c.execute("INSERT or IGNORE INTO users (username, balance) VALUES (?, 0)", [user])
|
||||
conn.commit()
|
||||
socketio.emit("update", "update")
|
||||
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>'
|
||||
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>'
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<p> </p>
|
||||
<div id="text">
|
||||
<h2>API:</h2>
|
||||
<p>Nobody wants to know how the API works</p>
|
||||
<h2>Error Codes:</h2>
|
||||
<p>170: Tag already exists</p>
|
||||
<p>054: Tag does not exists</p>
|
||||
|
|
Loading…
Reference in a new issue