Added cookie
This commit is contained in:
parent
d6beb7a040
commit
ec6f4d0793
@ -19,9 +19,6 @@ basic_auth = BasicAuth(app)
|
|||||||
|
|
||||||
@routes.route('/hkfc-d/motm/<randomUrlSuffix>')
|
@routes.route('/hkfc-d/motm/<randomUrlSuffix>')
|
||||||
def hkfcD_motm_vote(randomUrlSuffix):
|
def hkfcD_motm_vote(randomUrlSuffix):
|
||||||
identity = randomUrlSuffix(8)
|
|
||||||
id_commit = "INSERT INTO motmSessions (sessionID) VALUES (identity))"
|
|
||||||
sql_write(id_commit)
|
|
||||||
sql = "SELECT playerNumber, playerForenames, playerSurname, playerNickname FROM _hkfcD_matchSquad ORDER BY RAND()"
|
sql = "SELECT playerNumber, playerForenames, playerSurname, playerNickname FROM _hkfcD_matchSquad ORDER BY RAND()"
|
||||||
sql2 = "SELECT nextClub, nextTeam, nextDate, oppoLogo, hkfcLogo, currMotM, currDotD, nextFixture FROM hkfcDAdminSettings"
|
sql2 = "SELECT nextClub, nextTeam, nextDate, oppoLogo, hkfcLogo, currMotM, currDotD, nextFixture FROM hkfcDAdminSettings"
|
||||||
rows = sql_read(sql)
|
rows = sql_read(sql)
|
||||||
@ -56,9 +53,7 @@ def hkfcD_motm_vote(randomUrlSuffix):
|
|||||||
randomSuff = urlSuff[0]['motmUrlSuffix']
|
randomSuff = urlSuff[0]['motmUrlSuffix']
|
||||||
print(randomSuff)
|
print(randomSuff)
|
||||||
if randomSuff == randomUrlSuffix:
|
if randomSuff == randomUrlSuffix:
|
||||||
resp = render_template('_hkfcDMotmVote.html', data=rows, comment=comment, formatDate=formatDate, matchNumber=nextFixture, oppo=oppo, hkfcLogo=hkfcLogo, oppoLogo=oppoLogo, dotdURL=dotdURL, motmURL=motmURL, form=form)
|
return render_template('_hkfcDMotmVote.html', data=rows, comment=comment, formatDate=formatDate, matchNumber=nextFixture, oppo=oppo, hkfcLogo=hkfcLogo, oppoLogo=oppoLogo, dotdURL=dotdURL, motmURL=motmURL, form=form)
|
||||||
resp.setcookie('sessionID', id_commit)
|
|
||||||
return resp
|
|
||||||
else:
|
else:
|
||||||
return render_template('_error.html')
|
return render_template('_error.html')
|
||||||
|
|
||||||
@ -242,7 +237,7 @@ def hkfcD_vote_thanks():
|
|||||||
|
|
||||||
if _motm and _dotd and request.method == 'POST':
|
if _motm and _dotd and request.method == 'POST':
|
||||||
identity = randomUrlSuffix(8)
|
identity = randomUrlSuffix(8)
|
||||||
id_commit = "INSERT INTO motmSessions (sessionID) VALUES (identity))"
|
id_commit = "INSERT INTO motmSessions (sessionID) VALUES ('" + identity + "')"
|
||||||
sql_write(id_commit)
|
sql_write(id_commit)
|
||||||
sql = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, motmTotal, motm_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _motm + "' ON DUPLICATE KEY UPDATE motmTotal = motmTotal + 1, motm_" + _matchDate + " = motm_" + _matchDate + " + 1"
|
sql = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, motmTotal, motm_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _motm + "' ON DUPLICATE KEY UPDATE motmTotal = motmTotal + 1, motm_" + _matchDate + " = motm_" + _matchDate + " + 1"
|
||||||
sql2 = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, dotdTotal, dotd_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _dotd + "' ON DUPLICATE KEY UPDATE dotdTotal = dotdTotal + 1, dotd_" + _matchDate + " = dotd_" + _matchDate + " + 1"
|
sql2 = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, dotdTotal, dotd_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _dotd + "' ON DUPLICATE KEY UPDATE dotdTotal = dotdTotal + 1, dotd_" + _matchDate + " = dotd_" + _matchDate + " + 1"
|
||||||
@ -256,8 +251,8 @@ def hkfcD_vote_thanks():
|
|||||||
#sql_write(sql3)
|
#sql_write(sql3)
|
||||||
#sql_write(sql)
|
#sql_write(sql)
|
||||||
#sql_write(sql2)
|
#sql_write(sql2)
|
||||||
resp = render_template('_hkfcDVoteThanks.html')
|
resp = make_response(render_template('_hkfcDVoteThanks.html'))
|
||||||
resp.setcookie('sessionID', commit_id)
|
resp.set_cookie('sessionID', id_commit)
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
return 'Ouch ... something went wrong here'
|
return 'Ouch ... something went wrong here'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user