check_user.py
4.65 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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,])
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_kill(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 kill_cs from game_info where name=%s",[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_view(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 view_score from game_info where name=%s",[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_cs(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 cs from game_info where name=%s",[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_as(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 assist from game_info where name=%s",[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
def read_death(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 death from game_info where name=%s",[user_name,])
for rs in curs.fetchall():
temp=rs[0]
finally:
conn.close()
return temp
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_as("카나리아사"))
print(read_kill("카나리아사"))
print(read_cs("카나리아사"))
print(read_death("카나리아사"))
print(read_view("카나리아사"))