Voting not allowed and player redirected if he or she uses back button to access voting page

Could possible be made more efficient since it requires database query for each vote.
Made it a global function in the master file and refactored both vote.js and master.js to use new global function.