watch_list_name.py 684 B

123456789101112131415161718192021222324
  1. from .tool.func import *
  2. def watch_list_name_2(conn, name):
  3. curs = conn.cursor()
  4. if custom()[2] == 0:
  5. return redirect('/login')
  6. ip = ip_check()
  7. curs.execute("select count(title) from scan where user = ?", [ip])
  8. count = curs.fetchall()
  9. if count and count[0][0] > 9:
  10. return redirect('/watch_list')
  11. curs.execute("select title from scan where user = ? and title = ?", [ip, name])
  12. if curs.fetchall():
  13. curs.execute("delete from scan where user = ? and title = ?", [ip, name])
  14. else:
  15. curs.execute("insert into scan (user, title) values (?, ?)", [ip, name])
  16. conn.commit()
  17. return redirect('/watch_list')