| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- from .tool.func import *
- def user_count(name = None):
- with get_db_connect() as conn:
- curs = conn.cursor()
- if name == None:
- that = ip_check()
- else:
- that = name
- curs.execute(db_change("select count(*) from history where ip = ?"), [that])
- count = curs.fetchall()
- if count:
- data = count[0][0]
- else:
- data = 0
- curs.execute(db_change("select count(*) from topic where ip = ?"), [that])
- count = curs.fetchall()
- if count:
- data_topic = count[0][0]
- else:
- data_topic = 0
-
- date = get_time()
- date = date.split()
- date = date[0]
-
- curs.execute(db_change("select count(*) from history where date like ? and ip = ?"), [date + '%', that])
- count = curs.fetchall()
- if count:
- data_today = count[0][0]
- else:
- data_today = 0
-
- data_today_len = 0
-
- curs.execute(db_change("select leng from history where date like ? and ip = ?"), [date + '%', that])
- db_data = curs.fetchall()
- for count in db_data:
- data_today_len += int(count[0][1:])
- # 한글 지원 필요
- return easy_minify(flask.render_template(skin_check(),
- imp = [load_lang('count'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
- data = '''
- <ul class="inside_ul">
- <li><a href="/record/''' + url_pas(that) + '''">''' + load_lang('edit_record') + '''</a> : ''' + str(data) + '''</li>
- <li><a href="/record/topic/''' + url_pas(that) + '''">''' + load_lang('discussion_record') + '''</a> : ''' + str(data_topic) + '''</a></li>
- <hr>
- <li>(''' + load_lang('beta') + ''') TODAY : ''' + str(data_today) + '''</li>
- <li>(''' + load_lang('beta') + ''') TODAY LEN : ''' + str(data_today_len) + '''</li>
- </ul>
- ''',
- menu = [['user', load_lang('return')]]
- ))
|