ban-skript, neue parteien

This commit is contained in:
Enno Rehling 2002-03-24 11:53:58 +00:00
parent 3b0030bc61
commit 28ebdd637b
3 changed files with 39 additions and 0 deletions

18
scripts/register/ban.py Executable file
View File

@ -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

18
scripts/register/getfactions.py Executable file
View File

@ -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"

View File

@ -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;