Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def index():
|
|
35 |
def home():
|
36 |
if request.method == 'GET':
|
37 |
if 'email' in session:
|
38 |
-
app.config['MYSQL_DB'] = '
|
39 |
curh = mysql.cursor()
|
40 |
if session['usertype'] == 0:
|
41 |
curh.execute("SELECT `assessid`, `name` FROM assessments")
|
@@ -72,7 +72,7 @@ def home():
|
|
72 |
|
73 |
if request.method == 'POST':
|
74 |
if 'email' in session:
|
75 |
-
app.config['MYSQL_DB'] = '
|
76 |
|
77 |
curh = mysql.cursor()
|
78 |
|
@@ -113,7 +113,7 @@ def register():
|
|
113 |
if request.method == 'POST':
|
114 |
database = request.form['database']
|
115 |
if database == 'database1':
|
116 |
-
app.config['MYSQL_DB'] = '
|
117 |
session['database'] = app.config['MYSQL_DB']
|
118 |
elif database == 'database2':
|
119 |
app.config['MYSQL_DB'] = 'test2'
|
@@ -163,7 +163,7 @@ def register():
|
|
163 |
@app.route('/verify/<otp>')
|
164 |
def verify(otp):
|
165 |
if str(session['otp']) == otp:
|
166 |
-
app.config['MYSQL_DB'] = '
|
167 |
|
168 |
cur = mysql.cursor()
|
169 |
cur.execute("INSERT INTO users (name, email, password) VALUES (%s,%s,%s)", (session['name'], session['email'], session['hash'],))
|
@@ -197,7 +197,7 @@ def login():
|
|
197 |
now = datetime.datetime.now()
|
198 |
database = request.form['database']
|
199 |
if database == 'database1':
|
200 |
-
app.config['MYSQL_DB'] = '
|
201 |
elif database == 'database2':
|
202 |
app.config['MYSQL_DB'] = 'test2'
|
203 |
|
@@ -247,7 +247,7 @@ def forgot():
|
|
247 |
return render_template("forgot.html")
|
248 |
|
249 |
if request.method == 'POST':
|
250 |
-
app.config['MYSQL_DB'] = '
|
251 |
|
252 |
email = request.form['email']
|
253 |
session['email'] = email
|
@@ -301,7 +301,7 @@ def change():
|
|
301 |
return render_template("change.html")
|
302 |
|
303 |
if request.method == 'POST':
|
304 |
-
app.config['MYSQL_DB'] = '
|
305 |
|
306 |
password = request.form['password'].encode('utf-8')
|
307 |
hash_password = bcrypt.hashpw(password, bcrypt.gensalt())
|
@@ -327,7 +327,7 @@ def admin():
|
|
327 |
|
328 |
if request.method == 'GET':
|
329 |
if 'email' in session:
|
330 |
-
app.config['MYSQL_DB'] = '
|
331 |
|
332 |
cura = mysql.cursor()
|
333 |
|
@@ -379,7 +379,7 @@ def admin():
|
|
379 |
return render_template("admin.html", typedata=typedata_tuple, given=given_tuple, result=res_tuple, assess=que_tuple, abc=abc_tuple, ts=ts, ahi=ahi, tas=tas, feeds= feeds_tuple)
|
380 |
|
381 |
if request.method == "POST":
|
382 |
-
app.config['MYSQL_DB'] = '
|
383 |
|
384 |
if 'resid' in request.form:
|
385 |
resid = request.form.get('resid')
|
@@ -407,7 +407,7 @@ def form():
|
|
407 |
return redirect(url_for('login'))
|
408 |
|
409 |
if request.method == "GET":
|
410 |
-
app.config['MYSQL_DB'] = '
|
411 |
typeid = session['type']
|
412 |
curf = mysql.cursor()
|
413 |
curf.execute("SELECT `name`, `description`, `Questions`, `types` FROM assessments WHERE assessid = %s", (typeid,))
|
@@ -419,7 +419,7 @@ def form():
|
|
419 |
return render_template("form.html", questions=questions)
|
420 |
|
421 |
if request.method == "POST":
|
422 |
-
app.config['MYSQL_DB'] = '
|
423 |
|
424 |
data = request.form.to_dict()
|
425 |
|
@@ -495,7 +495,7 @@ def custom():
|
|
495 |
return render_template('custom.html')
|
496 |
|
497 |
if request.method == "POST":
|
498 |
-
app.config['MYSQL_DB'] = '
|
499 |
|
500 |
data = request.form.to_dict()
|
501 |
|
@@ -544,7 +544,7 @@ def result():
|
|
544 |
if 'email' not in session:
|
545 |
return redirect(url_for('home'))
|
546 |
|
547 |
-
app.config['MYSQL_DB'] = '
|
548 |
curr = mysql.cursor()
|
549 |
|
550 |
curr.execute("SELECT * FROM `custom` WHERE id=%s AND type=%s", (session['id'], session['type'],))
|
@@ -667,7 +667,7 @@ def result():
|
|
667 |
|
668 |
@app.route('/logout')
|
669 |
def logout():
|
670 |
-
app.config['MYSQL_DB'] = '
|
671 |
now = datetime.datetime.now()
|
672 |
curo = mysql.cursor()
|
673 |
if 'id' in session:
|
|
|
35 |
def home():
|
36 |
if request.method == 'GET':
|
37 |
if 'email' in session:
|
38 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
39 |
curh = mysql.cursor()
|
40 |
if session['usertype'] == 0:
|
41 |
curh.execute("SELECT `assessid`, `name` FROM assessments")
|
|
|
72 |
|
73 |
if request.method == 'POST':
|
74 |
if 'email' in session:
|
75 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
76 |
|
77 |
curh = mysql.cursor()
|
78 |
|
|
|
113 |
if request.method == 'POST':
|
114 |
database = request.form['database']
|
115 |
if database == 'database1':
|
116 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
117 |
session['database'] = app.config['MYSQL_DB']
|
118 |
elif database == 'database2':
|
119 |
app.config['MYSQL_DB'] = 'test2'
|
|
|
163 |
@app.route('/verify/<otp>')
|
164 |
def verify(otp):
|
165 |
if str(session['otp']) == otp:
|
166 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
167 |
|
168 |
cur = mysql.cursor()
|
169 |
cur.execute("INSERT INTO users (name, email, password) VALUES (%s,%s,%s)", (session['name'], session['email'], session['hash'],))
|
|
|
197 |
now = datetime.datetime.now()
|
198 |
database = request.form['database']
|
199 |
if database == 'database1':
|
200 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
201 |
elif database == 'database2':
|
202 |
app.config['MYSQL_DB'] = 'test2'
|
203 |
|
|
|
247 |
return render_template("forgot.html")
|
248 |
|
249 |
if request.method == 'POST':
|
250 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
251 |
|
252 |
email = request.form['email']
|
253 |
session['email'] = email
|
|
|
301 |
return render_template("change.html")
|
302 |
|
303 |
if request.method == 'POST':
|
304 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
305 |
|
306 |
password = request.form['password'].encode('utf-8')
|
307 |
hash_password = bcrypt.hashpw(password, bcrypt.gensalt())
|
|
|
327 |
|
328 |
if request.method == 'GET':
|
329 |
if 'email' in session:
|
330 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
331 |
|
332 |
cura = mysql.cursor()
|
333 |
|
|
|
379 |
return render_template("admin.html", typedata=typedata_tuple, given=given_tuple, result=res_tuple, assess=que_tuple, abc=abc_tuple, ts=ts, ahi=ahi, tas=tas, feeds= feeds_tuple)
|
380 |
|
381 |
if request.method == "POST":
|
382 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
383 |
|
384 |
if 'resid' in request.form:
|
385 |
resid = request.form.get('resid')
|
|
|
407 |
return redirect(url_for('login'))
|
408 |
|
409 |
if request.method == "GET":
|
410 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
411 |
typeid = session['type']
|
412 |
curf = mysql.cursor()
|
413 |
curf.execute("SELECT `name`, `description`, `Questions`, `types` FROM assessments WHERE assessid = %s", (typeid,))
|
|
|
419 |
return render_template("form.html", questions=questions)
|
420 |
|
421 |
if request.method == "POST":
|
422 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
423 |
|
424 |
data = request.form.to_dict()
|
425 |
|
|
|
495 |
return render_template('custom.html')
|
496 |
|
497 |
if request.method == "POST":
|
498 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
499 |
|
500 |
data = request.form.to_dict()
|
501 |
|
|
|
544 |
if 'email' not in session:
|
545 |
return redirect(url_for('home'))
|
546 |
|
547 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
548 |
curr = mysql.cursor()
|
549 |
|
550 |
curr.execute("SELECT * FROM `custom` WHERE id=%s AND type=%s", (session['id'], session['type'],))
|
|
|
667 |
|
668 |
@app.route('/logout')
|
669 |
def logout():
|
670 |
+
app.config['MYSQL_DB'] = 'sql12660485'
|
671 |
now = datetime.datetime.now()
|
672 |
curo = mysql.cursor()
|
673 |
if 'id' in session:
|