Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, render_template, request, url_for, redirect, session, abort, flash
- import os, mysql.connector
- app = Flask(__name__)
- app.secret_key = "blah*nelson"
- app.config['SESSION_TYPE'] = 'filesystem'
- @app.route("/")
- def home():
- return redirecthome()
- @app.route("/login", methods=['POST'])
- def login():
- conn = mysql.connector.connect(host='10.25.0.7', database='properties', user='root', password='Chrono245713')
- if conn.is_connected():
- cursor = conn.cursor()
- query = ("select password from users where username = ?", request.form['user'])
- cursor.execute(query)
- row = cursor.fetchone()
- if request.form['pword'] == row[0]:
- session['logged_in'] = True
- else:
- session['logged_in'] = False
- return mainline()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement