def bans(page): try: if error1(page): return redirect(url_for('bans')) con = core.connect_mdb() con.commit() cur = con.cursor() startat=(page*perpage)-perpage con.commit() r=get_info_bans(cur,perpage,startat) info=r[0]#['player_info'] #print(player_info) total=r[1] if error2(page,info): cur.close() con.close() return redirect(url_for('bans')) return render_template('main.html', title='BanList', info=info, base64=b64encode, page=page, total=(total//perpage)+2, perpage=perpage, ) cur.close() con.close() except Exception as e: return render_template('error.html', title='Home', error=str(e), )
def index(page): try: if error1(page): return redirect(url_for('index')) con = core.connect_mdb() con.commit() cur = con.cursor() startat=(page*perpage)-perpage r=get_info_all(cur,perpage,startat) result=r[0] total=r[1] if error2(page,result): cur.close() con.close() return redirect(url_for('index')) return render_template('main.html', title='Home', info=result, base64=b64encode, active='home', page=page, total=(total//perpage)+2, perpage=perpage, ) except Exception as e: return render_template('error.html', title='Home', error=str(e), ) cur.close() con.close()
def show_clan_profile(clanid): try: if error1(page): return redirect(url_for('index')) con = core.connect_mdb() con.commit() cur = con.cursor() clanid=b64decode(clanid.encode('utf-8')).decode("utf-8") if does_exist_clan(clanid,cur) is True: clan=get_clan_info(clanid,cur) return render_template('clan.html', title=clan['name'], clan=clan, base64=b64encode, ) else: return render_template('error.html', title='Error', error="Cannot Find this Clan!", ) cur.close() con.close() except Exception as e: return render_template('error.html', title='Home', error=str(e), )
def show_user_profile(userid): try: if error1(page): return redirect(url_for('index')) con = core.connect_mdb() con.commit() cur = con.cursor() userid=b64decode(userid.encode('utf-8')).decode("utf-8") if does_exist_player(userid,cur) is True: general_info=get_player_info_general(userid,cur) unit_level=get_player_units_level(userid,cur) spell_level=get_spell_level(userid,cur) hero_level=get_hero_level(userid,cur) units=get_player_units(userid,cur) spells=get_player_spells(userid,cur) clan=get_clan_info(general_info['clan'],cur) buildings=get_buildings(userid,cur) obstacles=get_obstacles(userid,cur) resources=get_resources(userid,cur) decos=get_decos(userid,cur) traps=get_traps(userid,cur) if error2(page,result): cur.close() con.close() return redirect(url_for('index')) return render_template('player.html', title=general_info['name'], general_info=general_info, unit_level=unit_level, spell_level=spell_level, hero_level=hero_level, units=units, spells=spells, clan=clan, buildings=buildings, obstacles=obstacles, resources=resources, decos=decos, traps=traps, base64=b64encode, ) else: return render_template('error.html', title='Error', error="Cannot Find this player!", ) cur.close() con.close() except Exception as e: return render_template('error.html', title='Home', error=str(e), )
def stats(): con = core.connect_mdb() con.commit() cur = con.cursor() try: r=get_ucs_detailed_info(cur) return render_template('stats.html', title='Stats', info=r, ) except Exception as e : return render_template('error.html', title='Error', error='Cannot Get Information:%s' % str(e), ) cur.close() con.close()