diff --git a/.nfs0000000001aa066600000010 b/.nfs0000000001aa066600000010 deleted file mode 100644 index e69de29..0000000 diff --git a/SQLlite.db b/SQLlite.db index f5979ea..8ae0e1f 100644 Binary files a/SQLlite.db and b/SQLlite.db differ diff --git a/static/styles.css b/static/styles.css index 07ad138..21added 100644 --- a/static/styles.css +++ b/static/styles.css @@ -76,3 +76,12 @@ footer { color: red; } /*# sourceMappingURL=styles.css.map */ + +.url{ + font-size: 150%; +} + +.url input{ + width: 75%; + font-size: 170%; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 4eae675..a9b1f57 100644 --- a/templates/base.html +++ b/templates/base.html @@ -41,6 +41,8 @@
  • banan
  • Login
  • Logout
  • +
  • registr
  • +
  • zkracovac
  • diff --git a/templates/zkracovac.html b/templates/zkracovac.html new file mode 100644 index 0000000..cbff731 --- /dev/null +++ b/templates/zkracovac.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} + +{%block title%}zkracovac{%endblock%} + +{% block obsah %} + +

    zkracovac URL

    + +
    + +

    + Zadej URL: + +

    + + +
    + +{% endblock obsah %} diff --git a/webface.py b/webface.py index bd49621..d69bd40 100644 --- a/webface.py +++ b/webface.py @@ -1,6 +1,8 @@ from pickle import GET from flask import Flask, render_template, request, redirect, url_for, session, flash import functools +import string +import random # from werkzeug.security import generate_password_hash, check_password_hash @@ -124,7 +126,7 @@ def registr_post(): page = request.args.get('page') with SQLite('SQLlite.db') as cur: - cur.execute('INSERT INTO user = ??', [jmeno, heslo]) + cur.execute('INSERT INTO user = (?, ?)', [jmeno, heslo]) ans = cur.fetchall() if heslo == heslo2: @@ -137,4 +139,24 @@ def registr_post(): flash('Nespávné přihlašovací udaje','error') if page: return redirect( url_for ('login', page=page)) - return redirect( url_for ('pomerance')) \ No newline at end of file + return redirect( url_for ('pomerance')) + + +@app.route("/zkracovac/") +def zkracovac(): + return render_template("zkracovac.html") + + + +@app.route("/zkracovac/", methods=['POST']) +def zkracovac_post(): + url = request.form.get('url') + zkratka = ''.join(random.choices(string.ascii_uppercase + + string.digits, k=5)) + + with SQLite('SQLlite.db') as cur: + cur.execute('INSERT INTO adresy (zkratka, adresa) VALUES (?, ?)', [zkratka, url]) + + + + return redirect(url_for('zkracovac')) \ No newline at end of file