from flask import Flask,render_template,request
import pymysql
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template("index.html")
@app.route('/login',methods=['POST','GET'])
def login():
if request.method=="GET":
username=request.args.get("floatingInput")
password=request.args.get("floatingPassword")
conn = pymysql.connect(host="", user="root", passwd="root", database="d1", charset="utf8")
cur = conn.cursor()
cur.execute("select * from login where name ='{}' and password='{}'".format(username, password))
aa = cur.fetchall()
if aa:
return render_template("add.html")
else:
return render_template("index.html")
conn.commit()
conn.close()
if __name__ == '__main__':
app.run()



