give_user_check.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. from .tool.func import *
  2. def give_user_check_2(conn, name):
  3. curs = conn.cursor()
  4. curs.execute(db_change("select acl from user where id = ? or id = ?"), [name, flask.request.args.get('plus', '-')])
  5. user = curs.fetchall()
  6. if user and user[0][0] != 'user':
  7. if admin_check() != 1:
  8. return re_error('/error/4')
  9. if admin_check(4, 'check (' + name + ')') != 1:
  10. return re_error('/error/3')
  11. num = int(number_check(flask.request.args.get('num', '1')))
  12. if num * 50 > 0:
  13. sql_num = num * 50 - 50
  14. else:
  15. sql_num = 0
  16. approval_question_div = ''
  17. if ip_or_user(name) == 0:
  18. curs.execute(db_change("select data from user_set where name = \"approval_question\" and id = ?"), [name])
  19. approval_question = curs.fetchall()
  20. if approval_question and approval_question[0][0]:
  21. approval_question = approval_question[0][0]
  22. approval_question_div = '''<table>
  23. <thead>
  24. <tr><td colspan="2">회원가입 질문</td></tr>
  25. </thead>
  26. <tbody>
  27. <tr><td>질문</td><td>''' + approval_question + '''
  28. '''
  29. curs.execute(db_change("select data from user_set where name = \"approval_question_answer\" and id = ?"), [name])
  30. approval_question_answer = curs.fetchall()
  31. if approval_question_answer and approval_question_answer[0]:
  32. approval_question_div += '<tr><td>답변</td><td>' + approval_question_answer[0][0] + '</td></tr>'
  33. approval_question_div += '</tbody></table><br>'
  34. if flask.request.args.get('plus', None):
  35. end_check = 1
  36. curs.execute(db_change("" + \
  37. "select name, ip, ua, today from ua_d " + \
  38. "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? or " + \
  39. ('ip' if ip_or_user(flask.request.args.get('plus', None)) == 1 else 'name') + " = ? " + \
  40. "order by today desc limit ?, 50" + \
  41. ""), [
  42. name,
  43. flask.request.args.get('plus', None),
  44. sql_num
  45. ])
  46. else:
  47. end_check = 0
  48. curs.execute(db_change("" + \
  49. "select name, ip, ua, today from ua_d " + \
  50. "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? order by today desc limit ?, 50" + \
  51. ""), [name, sql_num])
  52. record = curs.fetchall()
  53. if record:
  54. if not flask.request.args.get('plus', None):
  55. div = '<a href="/manager/14?plus=' + url_pas(name) + '">(' + load_lang('compare') + ')</a><hr class=\"main_hr\">'
  56. else:
  57. div = '<a href="/check/' + url_pas(name) + '">(' + name + ')</a> <a href="/check/' + url_pas(flask.request.args.get('plus', None)) + '">(' + flask.request.args.get('plus', None) + ')</a><hr class=\"main_hr\">'
  58. div += approval_question_div + '''
  59. <table id="main_table_set">
  60. <tbody>
  61. <tr>
  62. <td id="main_table_width">''' + load_lang('name') + '''</td>
  63. <td id="main_table_width">ip</td>
  64. <td id="main_table_width">''' + load_lang('time') + '''</td>
  65. </tr>
  66. '''
  67. for data in record:
  68. if data[2]:
  69. ua = data[2]
  70. else:
  71. ua = '<br>'
  72. div += '''
  73. <tr>
  74. <td>''' + ip_pas(data[0]) + '''</td>
  75. <td>''' + ip_pas(data[1]) + '''</td>
  76. <td>''' + data[3] + '''</td>
  77. </tr>
  78. <tr>
  79. <td colspan="3">''' + ua + '''</td>
  80. </tr>
  81. '''
  82. div += '''
  83. </tbody>
  84. </table>
  85. '''
  86. else:
  87. return re_error('/error/2')
  88. if end_check == 1:
  89. div += next_fix('/check/' + url_pas(name) + '?plus=' + flask.request.args.get('plus', None) + '&num=', num, record)
  90. else:
  91. div += next_fix('/check/' + url_pas(name) + '?num=', num, record)
  92. return easy_minify(flask.render_template(skin_check(),
  93. imp = [load_lang('check'), wiki_set(), custom(), other2([0, 0])],
  94. data = div,
  95. menu = [['manager', load_lang('return')]]
  96. ))