Skip to content

Commit

Permalink
pridani zkracovace
Browse files Browse the repository at this point in the history
  • Loading branch information
Karel Z committed Jan 5, 2023
1 parent 7c54ebb commit d099304
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 2 deletions.
Empty file removed .nfs0000000001aa066600000010
Empty file.
Binary file modified SQLlite.db
Binary file not shown.
9 changes: 9 additions & 0 deletions static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,12 @@ footer {
color: red;
}
/*# sourceMappingURL=styles.css.map */

.url{
font-size: 150%;
}

.url input{
width: 75%;
font-size: 170%;
}
2 changes: 2 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<li><a href="{{ url_for('banan') }}">banan</a></li>
<li><a href="{{ url_for('login') }}">Login</a></li>
<li><a href="{{ url_for('logout') }}">Logout</a></li>
<li><a href="{{ url_for('registr') }}">registr</a></li>
<li><a href="{{ url_for('zkracovac') }}">zkracovac</a></li>
</ul></nav>


Expand Down
19 changes: 19 additions & 0 deletions templates/zkracovac.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'base.html' %}

{%block title%}zkracovac{%endblock%}

{% block obsah %}

<h1>zkracovac URL</h1>

<form method="post">

<p class="url">
Zadej URL: <input type="text">
<button type="submit">zkratit</button>
</p>


</form>

{% endblock obsah %}
26 changes: 24 additions & 2 deletions webface.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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:

Expand All @@ -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'))
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'))

0 comments on commit d099304

Please sign in to comment.