from .tool.func import * def watch_list_name_2(conn, name): curs = conn.cursor() if custom()[2] == 0: return redirect('/login') ip = ip_check() curs.execute("select count(title) from scan where user = ?", [ip]) count = curs.fetchall() if count and count[0][0] > 9: return redirect('/watch_list') curs.execute("select title from scan where user = ? and title = ?", [ip, name]) if curs.fetchall(): curs.execute("delete from scan where user = ? and title = ?", [ip, name]) else: curs.execute("insert into scan (user, title) values (?, ?)", [ip, name]) conn.commit() return redirect('/watch_list')