user_info.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. from .tool.func import *
  2. def user_info_2(conn):
  3. curs = conn.cursor()
  4. ip = ip_check()
  5. curs.execute("select acl from user where id = ?", [ip])
  6. data = curs.fetchall()
  7. if ban_check() == 0:
  8. if data:
  9. if data[0][0] != 'user':
  10. acl = data[0][0]
  11. else:
  12. acl = load_lang('member')
  13. else:
  14. acl = load_lang('normal')
  15. else:
  16. acl = load_lang('blocked')
  17. match = re.search("^([0-9]{1,3}\.[0-9]{1,3})", ip)
  18. if match:
  19. match = match.groups()[0]
  20. else:
  21. match = '-'
  22. curs.execute("select end, login, band from ban where block = ? or block = ?", [ip, match])
  23. block_data = curs.fetchall()
  24. if block_data:
  25. if block_data[0][0] != '':
  26. acl += ' (' + load_lang('period') + ' : ' + block_data[0][0] + ')'
  27. else:
  28. acl += ' (' + load_lang('limitless') + ')'
  29. if block_data[0][1] != '':
  30. acl += ' (' + load_lang('login_able') + ')'
  31. if block_data[0][2] == 'O':
  32. acl += ' (' + load_lang('band_blocked') + ')'
  33. if custom()[2] != 0:
  34. ip_user = '<a href="/w/user:' + ip + '">' + ip + '</a>'
  35. plus = '''
  36. <li><a href="/logout">''' + load_lang('logout') + '''</a></li>
  37. <li><a href="/change">''' + load_lang('user_setting') + '''</a></li>
  38. '''
  39. curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
  40. if curs.fetchall():
  41. plus2 = '<li><a href="/alarm">' + load_lang('alarm') + ' (O)</a></li>'
  42. else:
  43. plus2 = '<li><a href="/alarm">' + load_lang('alarm') + '</a></li>'
  44. plus2 += '<li><a href="/watch_list">' + load_lang('watchlist') + '</a></li>'
  45. plus3 = '<li><a href="/acl/user:' + url_pas(ip) + '">' + load_lang('user_document_acl') + '</a></li>'
  46. else:
  47. ip_user = ip
  48. plus = '''
  49. <li><a href="/login">''' + load_lang('login') + '''</a></li>
  50. <li><a href="/register">''' + load_lang('register') + '''</a></li>
  51. '''
  52. plus2 = ''
  53. plus3 = ''
  54. curs.execute("select data from other where name = 'email_have'")
  55. test = curs.fetchall()
  56. if test and test[0][0] != '':
  57. plus += '<li><a href="/pass_find">' + load_lang('password_search') + '</a></li>'
  58. return easy_minify(flask.render_template(skin_check(),
  59. imp = [load_lang('user') + ' ' + load_lang('tool'), wiki_set(), custom(), other2([0, 0])],
  60. data = '''
  61. <h2>''' + load_lang('state') + '''</h2>
  62. <ul>
  63. <li>''' + ip_user + ''' <a href="/record/''' + url_pas(ip) + '''">(''' + load_lang('record') + ''')</a></li>
  64. <li>''' + load_lang('state') + ''' : ''' + acl + '''</li>
  65. </ul>
  66. <br>
  67. <h2>''' + load_lang('login') + '''</h2>
  68. <ul>
  69. ''' + plus + '''
  70. </ul>
  71. <br>
  72. <h2>''' + load_lang('tool') + '''</h2>
  73. <ul>
  74. ''' + plus3 + '''
  75. <li><a href="/custom_head">''' + load_lang('user_head') + '''</a></li>
  76. </ul>
  77. <br>
  78. <h2>''' + load_lang('other') + '''</h2>
  79. <ul>
  80. ''' + plus2 + '''
  81. <li>
  82. <a href="/count">''' + load_lang('count') + '''</a>
  83. </li>
  84. </ul>
  85. ''',
  86. menu = 0
  87. ))