From 28ebdd637b702812e7b9d58e6a66fb630538db69 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 Mar 2002 11:53:58 +0000 Subject: [PATCH] ban-skript, neue parteien --- scripts/register/ban.py | 18 ++++++++++++++++++ scripts/register/getfactions.py | 18 ++++++++++++++++++ scripts/register/waiting.sql | 3 +++ 3 files changed, 39 insertions(+) create mode 100755 scripts/register/ban.py create mode 100755 scripts/register/getfactions.py create mode 100644 scripts/register/waiting.sql diff --git a/scripts/register/ban.py b/scripts/register/ban.py new file mode 100755 index 000000000..598bdb1c5 --- /dev/null +++ b/scripts/register/ban.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import MySQLdb +import sys + +dbname=sys.argv[1] +db=MySQLdb.connect(db=dbname) + +cursor=db.cursor() +bans = cursor.execute("select user, users.email, users.status, userips.ip from bannedips, users, userips where users.status!='BANNED' and users.id=userips.user and userips.ip=bannedips.ip") +bc = db.cursor() +while bans: + bans=bans-1 + user, email, status, ip = cursor.fetchone() + if status!='ACTIVE': + bc.execute("update users set status='BANNED' where id="+str(int(user))) + else: + print email + " is active, and playing from banned ip "+ip diff --git a/scripts/register/getfactions.py b/scripts/register/getfactions.py new file mode 100755 index 000000000..59825e8c3 --- /dev/null +++ b/scripts/register/getfactions.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import MySQLdb +import sys + +dbname=sys.argv[1] +maxnum=int(sys.argv[2]) + +query = "select distinct u.email, s.race, u.locale from users u, subscriptions s left join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where s.user=u.id and b.ip is NULL and u.status='CONFIRMED' order by u.id" +db=MySQLdb.connect(db=dbname) +cursor = db.cursor() +num=cursor.execute(query) +if num>maxnum: + num=maxnum +while num: + num=num-1 + email, race, locale = cursor.fetchone() + print email+" "+race+" "+locale+" 0" diff --git a/scripts/register/waiting.sql b/scripts/register/waiting.sql new file mode 100644 index 000000000..936d1d234 --- /dev/null +++ b/scripts/register/waiting.sql @@ -0,0 +1,3 @@ +select distinct u.email, s.race, u.locale from users u, subscriptions s left +join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where +s.user=u.id and b.ip is NULL and u.status='CONFIRMED' order by u.id;