check_user.py
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import pymysql
def select(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
check=0
try:
with conn.cursor() as curs:
sql = "select name from user_info"
curs.execute(sql)
rs = curs.fetchall()
for row in rs:
if user_name in row:
check=1
finally:
conn.close()
return check
def read_level(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
try:
with conn.cursor() as curs:
sql ="select level from user_info where name=%s"
curs.execute(sql,[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_score(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
try:
with conn.cursor() as curs:
sql ="select opscore from analysis_info where name=%s"
curs.execute(sql,[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_game(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
try:
with conn.cursor() as curs:
curs.execute("select * from game_info where name=%s",[user_name,])
i=0
for rs in curs.fetchall():
temp=rs
finally:
conn.close()
lst=list(temp)
return lst[1],lst[2],lst[3],lst[4],lst[5]
def read_season(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
try:
with conn.cursor() as curs:
curs.execute("select season from match_info where name=%s",[user_name,])
for i in curs.fetchall():
temp=i[0]
break
finally:
conn.close()
return temp
def read_country(user_name):
conn = pymysql.connect(host='localhost', user='root', password="!!fnsldkwjsrl11", db="project_troll", charset='utf8')
try:
with conn.cursor() as curs:
curs.execute("select country from match_info where name=%s",[user_name,])
for i in curs.fetchall():
temp=i[0]
break
finally:
conn.close()
return temp
print(read_game("카나리아사"))
print(read_level("카나리아사"))
print(read_country("카나리아사"))
print(read_season("카나리아사"))
print(read_score("카나리아사"))