From c866a32435098075af28c125db567fdff2cff10c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 7 Apr 2002 09:11:48 +0000 Subject: [PATCH] Neustart in alten Regionen, Skripte --- scripts/cgi-bin/eressea-register.py | 17 ++++++++++++----- scripts/register/getfactions.py | 8 +++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/cgi-bin/eressea-register.py b/scripts/cgi-bin/eressea-register.py index 5ead87626..a8616338e 100755 --- a/scripts/cgi-bin/eressea-register.py +++ b/scripts/cgi-bin/eressea-register.py @@ -75,12 +75,12 @@ def ValidEmail(email): return 0 return 1 -def genpasswd(): - newpasswd="" +def genpasswd(): + newpasswd="" chars = string.letters + string.digits - for i in range(8): - newpasswd = newpasswd + choice(chars) - return newpasswd + for i in range(8): + newpasswd = newpasswd + choice(chars) + return newpasswd Form = cgi.FieldStorage() @@ -98,6 +98,7 @@ locale=GetKey(Form, "locale") referrer=GetKey(Form, "referrer") firsttime=GetKey(Form, "firsttime") +bonus=GetKey(Form, "bonus") if (locale==None) or (lastname==None) or (race==None) or (firstname==None) or (address==None) or (city==None): output="

Um Dich zu Eressea anzumelden musst Du das Formular vollständig ausfüllen.\n " @@ -138,6 +139,12 @@ else: if referrer!=None: fields=fields+", referrer" values=values+", '"+referrer+"'" + if bonus!=None: + fields=fields+", bonus" + if bonus=='yes': + values=values+", 1" + else: + values=values+", 0" if firsttime!=None: fields=fields+", firsttime" if firsttime=='yes': diff --git a/scripts/register/getfactions.py b/scripts/register/getfactions.py index fbe6ffce2..b0f66d4e0 100755 --- a/scripts/register/getfactions.py +++ b/scripts/register/getfactions.py @@ -6,7 +6,7 @@ import sys dbname=sys.argv[1] maxnum=int(sys.argv[2]) -query = "select distinct u.email, r.name, u.locale from users u, races r, 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' and r.race=s.race and r.locale='de' order by u.id" +query = "select distinct u.email, r.name, u.locale, s.bonus from users u, races r, 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' and r.race=s.race and r.locale='de' order by u.id" db=MySQLdb.connect(db=dbname) cursor = db.cursor() num=cursor.execute(query) @@ -14,5 +14,7 @@ if num>maxnum: num=maxnum while num: num=num-1 - email, race, locale = cursor.fetchone() - print email+" "+race+" "+locale+" 0" + email, race, locale, bonus = cursor.fetchone() + if bonus=None: + bonus=1 + print email+" "+race+" "+locale+" "+str(int(bonus))