user_count.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from .tool.func import *
  2. def user_count(name = None):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if name == None:
  6. that = ip_check()
  7. else:
  8. that = name
  9. curs.execute(db_change("select count(*) from history where ip = ?"), [that])
  10. count = curs.fetchall()
  11. if count:
  12. data = count[0][0]
  13. else:
  14. data = 0
  15. curs.execute(db_change("select count(*) from topic where ip = ?"), [that])
  16. count = curs.fetchall()
  17. if count:
  18. t_data = count[0][0]
  19. else:
  20. t_data = 0
  21. return easy_minify(flask.render_template(skin_check(),
  22. imp = [load_lang('count'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
  23. data = '''
  24. <ul class="inside_ul">
  25. <li><a href="/record/''' + url_pas(that) + '''">''' + load_lang('edit_record') + '''</a> : ''' + str(data) + '''</li>
  26. <li><a href="/record/topic/''' + url_pas(that) + '''">''' + load_lang('discussion_record') + '''</a> : ''' + str(t_data) + '''</a></li>
  27. </ul>
  28. ''',
  29. menu = [['user', load_lang('return')]]
  30. ))