Neustart in alten Regionen, Skripte

This commit is contained in:
Enno Rehling 2002-04-07 09:11:48 +00:00
parent fcef0c7821
commit c866a32435
2 changed files with 17 additions and 8 deletions

View File

@ -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="<p>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':

View File

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