Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from flask import Flask, render_template, redirect, request, url_for
- import MySQLdb
- import sys
- app = Flask(__name__)
- app.debug = True
- con = MySQLdb.connect("127.0.0.1","root","root")
- cur = con.cursor()
- print "nMySQLdb connection OKn"
- @app.route('/')
- @app.route('/index')
- def f_index():
- return render_template('index.html')
- @app.route('/login', methods = ['POST'])
- def f_signup():
- __username = request.form['username']
- __password = request.form['password']
- query_login = "SELECT * FROM EmpData.User WHERE UserName='{}' and PassWord='{}' " .format(__username, __password)
- try:
- if cursor.execute(query_login):
- return "Login OK"
- else:
- return "Login NOK"
- except:
- return "Query failed..."
- if __name__ == '__main__':
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement