from .tool.func import * def give_user_check_2(conn, name): curs = conn.cursor() plus_id = flask.request.args.get('plus', None) if admin_check('all', None, name) == 1 or (plus_id and admin_check('all', None, plus_id) == 1): if admin_check() != 1: return re_error('/error/4') num = int(number_check(flask.request.args.get('num', '1'))) sql_num = (num * 50 - 50) if num * 50 > 0 else 0 div = '' check_type = flask.request.args.get('type', '') if admin_check(4, (check_type + ' ' if check_type != '' else '') + 'check (' + name + ')') != 1: return re_error('/error/3') if check_type == '': if ip_or_user(name) == 0: curs.execute(db_change("select data from user_set where name = \"approval_question\" and id = ?"), [name]) approval_question = curs.fetchall() if approval_question and approval_question[0][0]: curs.execute(db_change("select data from user_set where name = \"approval_question_answer\" and id = ?"), [name]) approval_question_answer = curs.fetchall() if approval_question_answer and approval_question_answer[0]: div += '''
Q ''' + approval_question[0][0] + ''' A ''' + approval_question_answer[0][0] + '''

''' if plus_id: plus = "or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? " set_list = [name, plus_id, sql_num] if num == 1: curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? " ""), [name, plus_id]) all_ip_count = len(curs.fetchall()) curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ?" + \ ""), [name]) a_ip_count = len(curs.fetchall()) curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? " ""), [plus_id]) b_ip_count = len(curs.fetchall()) if a_ip_count + b_ip_count != all_ip_count: div += load_lang('same_ip_exist') + '
' else: plus = '' set_list = [name, sql_num] curs.execute(db_change("" + \ "select name, ip, ua, today from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " + \ plus + \ "order by today desc limit ?, 50" + \ ""), set_list) record = curs.fetchall() if record: if not plus_id: div = '' + \ '(' + load_lang('compare') + ') ' + \ '(' + load_lang('simple_check') + ')' + \ '
' + \ '' + div else: div = '' + \ '(' + name + ') ' + \ '(' + plus_id + ')' + \ '
' + \ '' + div div += ''' ''' set_n = 0 for data in record: if data[2]: if len(data[2]) > 300: ua = '' + \ '(300+)' + \ '' + \ '' set_n += 1 else: ua = html.escape(data[2]) else: ua = '
' div += ''' ''' div += '''
''' + load_lang('name') + ''' ''' + load_lang('ip') + ''' ''' + load_lang('time') + '''
''' + data[0] + ''' ''' + data[1] + ''' ''' + data[3] + '''
''' + ua + '''
''' else: return re_error('/error/2') div += next_fix( '/check/' + url_pas(name) + ('?plus=' + plus_id + '&num=' if plus_id else '?num='), num, record ) return easy_minify(flask.render_template(skin_check(), imp = [load_lang('check'), wiki_set(), custom(), other2([0, 0])], data = div, menu = [['manager', load_lang('return')]] )) else: curs.execute(db_change("" + \ "select distinct " + ('name' if ip_or_user(name) == 1 else 'ip') + " from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " "order by today desc limit ?, 50" + \ ""), [name, sql_num]) record = curs.fetchall() div = '' for i in record: div += '
  • ' + i[0] + '
  • ' if div != '': div = '' div += next_fix( '/check/' + url_pas(name) + '?type=' + check_type + '&num=', num, record ) return easy_minify(flask.render_template(skin_check(), imp = [name, wiki_set(), custom(), other2(['(' + load_lang('simple_check') + ')', 0])], data = div, menu = [['check/' + url_pas(name), load_lang('return')]] ))