Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
metinkeremurkmez authored Feb 17, 2021
1 parent 85f2f2d commit d1ece19
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Airline-Database/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_mysqldb import MySQL

app = Flask(__name__)
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = 'K+332776:x'
app.config['MYSQL_DB'] = 'airline'

mysql = MySQL(app)

app.secret_key = "mysecretkey"

@app.route('/')
def index():
return render_template('index.html')

@app.route('/results', methods=['GET','POST'])
def results():
if request.method == 'POST':
cursor_ = mysql.connection.cursor()
passport = request.form.get('passport_no')
passport = int(passport)
cursor_.execute(
"SELECT ffp.Ffp_Status FROM ffp,member_of WHERE Passport_no = %s and member_of.Ffp_id = ffp.Ffp_id",
(passport,))
status = cursor_.fetchall()

cursor_.execute(
"SELECT ffp.Ffp_name FROM ffp,member_of WHERE Passport_no = %s and member_of.Ffp_id = ffp.Ffp_id",
(passport,))
ffpId = cursor_.fetchall()


if status[0][0] == 'A':
flash(ffpId[0][0]+' Programında SPECIAL RANK(A) sahibisiniz.')
return redirect(url_for('index'))


if __name__ == '__main__':
app.run(port=3000, debug=True)
15 changes: 15 additions & 0 deletions Airline-Database/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<form action="/results" method="post">

<input type = "text" name = "passport_no" placeholder="Passport_no">
<button type="submit">
Get Status
</button>
</form>

{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<p>{{ message }}</p>
{% endfor %}
{% endif %}
{% endwith %}

0 comments on commit d1ece19

Please sign in to comment.