diff --git a/scripts/cgi-bin/eressea-confirm.py b/scripts/cgi-bin/eressea-confirm.py
new file mode 100755
index 000000000..0a972f920
--- /dev/null
+++ b/scripts/cgi-bin/eressea-confirm.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+# If (password, custid) exist in the database, and the user is in state
+# 'WAITING', he will be changed to 'CONFIRMED'.
+
+import sys
+import MySQLdb
+import cgi
+import os
+import re
+
+# specify the filename of the template file
+HTMLTemplate = "eressea.html"
+DefaultTitle = "Eressea Anmeldung"
+dbname = "eressea"
+db=None
+tutorial_id=1 # the tuorial game has id 1
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(HTMLTemplate, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print "Content-Type: text/html\n\n"
+ print SubResult[0]
+ return
+
+
+def GetKey(Form, key):
+ if Form.has_key(key):
+ value=Form[key].value
+ if value!="":
+ return value
+ return None
+
+
+def genpasswd():
+ newpasswd=""
+ chars = string.letters + string.digits
+ for i in range(8):
+ newpasswd = newpasswd + choice(chars)
+ return newpasswd
+
+
+#Display("Derzeit ist wegen einer technischen Umstellung keine Anmeldung möglich")
+#sys.exit(0)
+
+Form = cgi.FieldStorage()
+
+custid=GetKey(Form, "custid")
+password=GetKey(Form, "password")
+
+if (password==None) or (custid==None):
+ output="
Um Deine Anmeldung zu bestätigen musst Du das Formular vollständig ausfüllen.\n "
+ for key in Form.keys():
+ output=output+" "+str(key)+"="+str(Form[key])
+ Display(output)
+else:
+ db=MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+ try:
+ custid=int(custid)
+ except:
+ custid=0
+ query = "select u.status, s.id, s.game from users u, subscriptions s where u.id="+str(custid)+" and s.status in ('WAITING', 'CONFIRMED') and u.status not in ('INVALID', 'BANNED') and s.password='"+password+"'"
+ exist=cursor.execute(query)
+ if exist==0:
+ Display('
Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.')
+ else:
+ status, sid, gid = cursor.fetchone()
+ if os.environ.has_key('REMOTE_ADDR'):
+ ip=os.environ['REMOTE_ADDR']
+ cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(custid)+")")
+ if status=='NEW' or status=='TUTORIAL':
+ if tutorial_id!=None and gid==tutorial_id:
+ # user confirms his tutorial participation
+ cursor.execute("update users set status='TUTORIAL' where id="+str(custid))
+ else:
+ cursor.execute("update users set status='ACTIVE' where id="+str(custid))
+ cursor.execute("update subscriptions set status='CONFIRMED' where id="+str(sid))
+
+ Display("
Deine Anmeldung wurde bestätigt.");
+ db.close()
diff --git a/scripts/cgi-bin/eressea-register.py b/scripts/cgi-bin/eressea-register.py
new file mode 100755
index 000000000..1d6c37a67
--- /dev/null
+++ b/scripts/cgi-bin/eressea-register.py
@@ -0,0 +1,209 @@
+#!/usr/bin/env python
+
+## this cgi script adds a new user to the eressea DB,
+## as well as a new subscription entry. it logs IP addresses for registrations.
+
+import sys
+import MySQLdb
+import os
+import cgi
+import re
+import string
+import smtplib
+from whrandom import choice
+
+# specify the filename of the template file
+HTMLTemplate = "eressea.html"
+MailTemplate="register.mail"
+DefaultTitle = "Eressea Anmeldung"
+dbname = "eressea"
+From = "accounts@eressea-pbem.de"
+locale="de"
+smtpserver = 'localhost'
+db=None
+game_id=0 # Eressea Main game
+tutorial_id=1 # 1 to active, None to disable tutorials
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(HTMLTemplate, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print "Content-Type: text/html\n\n"
+ print SubResult[0]
+ return
+
+
+def Send(email, custid, sid, firstname, password, game):
+ cursor=db.cursor()
+ cursor.execute("select count(*), g.name from games g, subscriptions s where g.id="+str(game)+" AND (s.status='WAITING' or s.status='CONFIRMED') AND g.id=s.game GROUP BY g.id")
+ position, name = cursor.fetchone()
+ TemplateHandle = open(MailTemplate+"."+string.lower(name)+"."+locale, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ SubResult = re.subn("", firstname, TemplateInput)
+ SubResult = re.subn("", password, SubResult[0])
+ SubResult = re.subn("", str(int(position)), SubResult[0])
+ SubResult = re.subn("", name, SubResult[0])
+ SubResult = re.subn("", str(int(custid)), SubResult[0])
+ subject={"de":"Anmeldung","en":"Registration"}
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: "+name+" "+subject[locale]+"\n\n"
+ Msg=Msg+SubResult[0]
+ server=smtplib.SMTP(smtpserver)
+ server.sendmail(From, email, Msg)
+ server.close()
+ return
+
+def GetKey(Form, key):
+ if Form.has_key(key):
+ value=Form[key].value
+ if value!="":
+ return value
+ return None
+
+def ValidEmail(email):
+ if string.find(email, "@")==-1:
+ return 0
+ elif string.find(email, " ")!=-1:
+ return 0
+ return 1
+
+def genpasswd():
+ newpasswd=""
+ chars = string.letters + string.digits
+ for i in range(8):
+ newpasswd = newpasswd + choice(chars)
+ return newpasswd
+
+#Display("Derzeit ist wegen einer technischen Umstellung keine Anmeldung möglich")
+#sys.exit(0)
+
+Form = cgi.FieldStorage()
+
+email=GetKey(Form, "email")
+firstname=GetKey(Form, "firstname")
+lastname=GetKey(Form, "lastname")
+#info=GetKey(Form, "info")
+address=GetKey(Form, "address")
+city=GetKey(Form, "city")
+country=GetKey(Form, "country")
+phone=GetKey(Form, "phone")
+race=GetKey(Form, "race")
+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 "
+ for key in Form.keys():
+ output=output+" "+key+": "+Form[key].value+"\n"
+ Display(output)
+elif ValidEmail(email)==0:
+ output="
Um Dich zu Eressea anzumelden musst Du eine gültige Email-Adresse angeben.\n "
+ Display(output)
+else:
+ db=MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+ # check if he is already entered in the main game:
+ exist=cursor.execute("select u.id from users u, subscriptions s where s.user=u.id AND s.game="+str(game_id)+" AND u.email='"+email+"' and (s.status='WAITING' or s.status='CONFIRMED')")
+ if exist:
+ text={"de":"Du stehst bereits auf der Warteliste","en":"You are already on the waiting list"}
+ Display('
'+text[locale])
+ else:
+ bans=cursor.execute('select regex, reason from bannedemails')
+ while bans:
+ bans=bans-1
+ regexp, reason = cursor.fetchone()
+ if (re.match(regexp, email, re.IGNORECASE))!=None:
+ Display('Deine Email-Adresse ist für Eressea nicht zugelassen. '+reason)
+ sys.exit(0)
+
+ # create a new user record
+ fields = "firstname, lastname, locale, email, address, city"
+ values = "'"+firstname+"', '"+lastname+"', '"+locale+"', '"+email+"', '"+address+"', '"+city+"'"
+ if phone!=None:
+ fields=fields+", phone"
+ values=values+", '"+phone+"'"
+# if info!=None:
+# fields=fields+", info"
+# values=values+", '"+info+"'"
+ if country!=None:
+ fields=fields+", country"
+ values=values+", "+country+""
+ if referrer!=None:
+ fields=fields+", referrer"
+ values=values+", '"+referrer+"'"
+ if firsttime!=None:
+ fields=fields+", firsttime"
+ if firsttime=='yes':
+ values=values+", 1"
+ else:
+ values=values+", 0"
+ exist=cursor.execute("select password, status, id from users where email='"+email+"'")
+ custid=0
+ status='NEW'
+ if exist:
+ # user exists, update his data
+ password, status, custid=cursor.fetchone()
+ if status=='BANNED':
+ Display('Dein Account ist gesperrt. Bitte wende Dich an accounts@eressea-pbem.de falls Du Fragen zu dieser Meldung hast.')
+ sys.exit(0)
+ fields=fields+", id, status"
+ values=values+", "+str(custid)+", '"+status+"'"
+ command="REPLACE"
+ cursor.execute("REPLACE into users ("+fields+") VALUES ("+values+")")
+ else:
+ password = genpasswd()
+ fields=fields+", password, status"
+ values=values+", '"+password+"', 'NEW'"
+ cursor.execute("INSERT into users ("+fields+") VALUES ("+values+")")
+ cursor.execute("SELECT LAST_INSERT_ID() from dual")
+ custid=cursor.fetchone()[0]
+
+ # track IP addresses
+ ip=None
+ if os.environ.has_key('REMOTE_ADDR'):
+ ip=os.environ['REMOTE_ADDR']
+ if ip!=None:
+ cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
+
+ game = game_id
+ if tutorial_id!=None and status!='ACTIVE':
+ game=tutorial_id
+ exist = cursor.execute("select id, password from subscriptions where status='WAITING' AND user="+str(custid)+" and game="+str(game))
+ if exist:
+ sid, password = cursor.fetchone()
+ else:
+ # add a subscription record
+ password = genpasswd()
+ values="'WAITING', '"+password+"'"
+ fields="status, password"
+ if bonus!=None:
+ fields=fields+", bonus"
+ if bonus=='yes':
+ values=values+", 1"
+ else:
+ values=values+", 0"
+ cursor.execute("insert into subscriptions (user, race, game, "+fields+") VALUES ("+str(int(custid))+", '"+race+"', "+str(game)+", "+values+")")
+ cursor.execute("SELECT LAST_INSERT_ID() from dual")
+ sid = cursor.fetchone()[0]
+ Send(email, custid, sid, firstname, password, game)
+ text={"de":"Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir", "en":"Your application was processed. An email containing further instructions is being sent to you"}
+ Display("
"+text[locale]+".")
+ db.close()
diff --git a/scripts/cgi-bin/info.py b/scripts/cgi-bin/info.py
new file mode 100755
index 000000000..86aa74ca0
--- /dev/null
+++ b/scripts/cgi-bin/info.py
@@ -0,0 +1,319 @@
+#!/usr/bin/env python
+
+import sys
+import MySQLdb
+import cgi
+import re
+import smtplib
+
+# specify the filename of the template file
+scripturl="http://eressea.upb.de/cgi-bin/eressea/info.py"
+TemplateFile = "/home/enno/www/cgi-bin/vinyambar.html"
+DefaultTitle = "Vinyambar Datenbank"
+dbname = "vinyambar"
+From = "accounts@vinyambar.de"
+smtpserver = 'localhost'
+Errors = ""
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(TemplateFile, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+# for key in Form.keys():
+# Content=Content+" "+str(key)+"="+str(Form[key])
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print "Content-Type: text/html\n\n"
+ print SubResult[0]
+ return
+
+
+def SendTransfer(userid, factionid, game):
+ db = MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+ cursor.execute("select email, firstname from users where id="+str(userid))
+ email, firstname = cursor.fetchone()
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: Vinambar Passwort\n\n"
+ Msg=Msg+"Hallo, "+firstname+"\n"
+ Msg=Msg+"Ein Spieler hat Dir seine Partei " + factionid + " im Spiel " + game + "\n"
+ Msg=Msg+"übertragen. Um die Partei zu übernehmen, gehe bitte auf die Webseite \n"
+ Msg=Msg+"http://www.vinyambar.de/accounts.shtml, und akzeptiere dort den Transfer.\n"
+ server=smtplib.SMTP(smtpserver)
+ server.sendmail(From, email, Msg)
+ server.close()
+ db.close()
+ return
+
+
+def SendPass(email):
+ try:
+ db = MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+# print custid
+ cursor.execute("select id, email, password from users where email='"+email+"'")
+ custid, email, password = cursor.fetchone()
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: Vinambar Passwort\n\n"
+ Msg=Msg+"Deine Kundennummer ist: "+str(int(custid))+"\n"
+ Msg=Msg+"Dein Vinyambar-Passwort lautet: "+password+"\n"
+ Msg=Msg+"\nDiese Mail wurde an Dich versandt, weil Du (oder jemand anders) \n"
+ Msg=Msg+"es im Formular auf http://www.vinyambar.de/accounts.shtml angefordert hat.\n"
+ server=smtplib.SMTP(smtpserver)
+ server.sendmail(From, email, Msg)
+ server.close()
+ db.close()
+ Display('
Beim Versenden des Passwortes ist ein Fehler aufgetreten. Eventuell ist die email-Adresse unbekannt
', 'Kundendaten für '+email)
+
+
+def ShowInfo(custid, Password):
+ global Errors
+ db = MySQLdb.connect(db=dbname)
+ cursor = db.cursor()
+ query=("select firstname, lastname, email, address, city, country, phone, status "+
+ "from users "+
+ "where id="+str(custid)+" and password='"+Password+"' ")
+
+ results = cursor.execute(query)
+ if results != 0:
+ firstname, lastname, email, address, city, country, phone, status = cursor.fetchone()
+ if status=='WAITING':
+ cursor.execute("update users set status='CONFIRMED' where id="+str(custid))
+ cursor.execute("select max(date), max(id) from transactions")
+ lastdate, id = cursor.fetchone()
+
+ nraces = cursor.execute("select distinct race, name from races where locale='de'")
+ races=[('', 'Keine Anmeldung')]
+ while nraces>0:
+ nraces = nraces - 1
+ races.append(cursor.fetchone())
+
+ output = '
Letzter Buchungstag: '+str(lastdate)[0:10]+'
"
+ else:
+ output = "Die Kundennummer oder das angegebene Passwort sind nicht korrekt."
+ db.close()
+ Display(output, "Kundendaten #"+str(custid))
+ Errors = ""
+
+def TransferFaction(sid, faction, olduser, newuser, game, gid):
+ db = MySQLdb.connect(db=dbname)
+ update = db.cursor()
+ exist = update.execute("select id from users where id="+str(int(newuser)))
+ if exist==1:
+ update.execute("INSERT into transfers (subscription, src, dst, reason) values ("+str(int(sid))+", "+str(int(olduser))+", "+str(int(newuser))+", 'TRANSFER')")
+ update.execute("UPDATE subscriptions set status='TRANSFERED', user=" + str(newuser) + " where id="+str(sid))
+ SendTransfer(newuser, faction, game);
+ db.close()
+ return
+
+def Save(custid, Password):
+ global Errors
+ validkeys=['email','address','lastname','firstname','city','password','phone']
+ values='id='+str(custid)
+ for key in Form.keys():
+ if key in validkeys:
+ values=values+", "+key+"='"+Form[key].value+"'"
+ db = MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+ cursor.execute('UPDATE users SET '+values+' where id='+str(custid))
+
+ ngames = cursor.execute("select id from games where status='WAITING'")
+ while ngames > 0:
+ ngames=ngames - 1
+ gid = cursor.fetchone()[0]
+ key="race_"+str(int(gid))
+ update = db.cursor()
+ if Form.has_key(key):
+ newrace=Form[key].value
+ if newrace=='':
+ newrace=None
+ if newrace==None:
+ update.execute('delete from subscriptions where user='+str(int(custid))+' and game='+str(int(gid)))
+ else:
+ exist=update.execute('select id, race from subscriptions where game='+str(int(gid))+' and user='+str(int(custid)))
+ if exist>0:
+ sid, race = update.fetchone()
+ if race!=newrace:
+ update.execute("update subscriptions set race='"+newrace+"' where id="+str(int(sid)))
+ else:
+ update.execute("insert subscriptions (race, user, status, game) values ('"+newrace+"', "+str(int(custid))+", 'WAITING', "+str(int(gid))+")")
+ else:
+ update.execute('delete from subscriptions where user='+str(int(custid))+' and game='+str(int(gid)))
+
+ nfactions = cursor.execute("select g.id, g.name, s.id, faction from games g, subscriptions s where s.status='ACTIVE' and s.user="+str(custid) + " and s.game=g.id")
+ while nfactions > 0:
+ gid, game, sid, faction = cursor.fetchone()
+ if Form.has_key("cancel_"+faction):
+ update = db.cursor()
+ update.execute("UPDATE subscriptions set status='CANCELLED' where id="+str(int(sid)))
+ elif Form.has_key("transfer_"+faction):
+ newuser = int(Form["transfer_"+faction].value)
+ TransferFaction(sid, faction, custid, newuser, game, gid)
+ nfactions = nfactions - 1
+
+ nfactions = cursor.execute("select g.id, g.name, s.id, faction from games g, subscriptions s where s.status='TRANSFERED' and s.user="+str(custid) + " and s.game=g.id")
+ while nfactions > 0:
+ gid, game, sid, faction = cursor.fetchone()
+ if Form.has_key("accept_"+faction):
+ update = db.cursor()
+ i = update.execute("SELECT count(*) from subscriptions where status='ACTIVE' and game="+str(int(gid)))
+ if i==0:
+ update.execute("UPDATE subscriptions set status='ACTIVE' where id="+str(int(sid)))
+ else:
+ Errors=Errors+"Du hast bereits eine Aktive Partei in "+game+" \n"
+ nfactions = nfactions - 1
+
+ nfactions = cursor.execute("select g.name, s.id, faction from games g, subscriptions s where s.status='CANCELLED' and s.user="+str(custid) + " and s.game=g.id")
+ while nfactions > 0:
+ game, sid, faction = cursor.fetchone()
+ if Form.has_key("activate_"+faction):
+ update = db.cursor()
+ update.execute("UPDATE subscriptions set status='ACTIVE' where id="+str(int(sid)))
+ nfactions = nfactions - 1
+
+ db.close()
+ ShowInfo(custid, Password)
+# Display("Noch nicht implementiert", "Daten speichern für Kunde #"+str(custid))
+
+
+Form = cgi.FieldStorage()
+
+if Form.has_key("user"):
+ custid = int(Form["user"].value)
+else:
+ custid = 0
+
+if Form.has_key("pass"):
+ Password = Form["pass"].value
+else:
+ Password=""
+
+if Form.has_key("sendpass"):
+ if Form.has_key("email"):
+ Email = Form["email"].value
+ else:
+ Email=""
+ SendPass(Email)
+elif Form.has_key("save"):
+ Save(custid, Password)
+else:
+ ShowInfo(custid, Password)
diff --git a/scripts/cgi-bin/poll2001.py b/scripts/cgi-bin/poll2001.py
new file mode 100755
index 000000000..7ca2d4ee3
--- /dev/null
+++ b/scripts/cgi-bin/poll2001.py
@@ -0,0 +1,213 @@
+#!/usr/bin/env python
+
+import sys
+import MySQLdb
+import cgi
+import re
+
+# specify the filename of the template file
+TemplateFile = "vinyambar.html"
+DefaultTitle = "Eressea Umfrage 2001"
+dbname = "eressea"
+myurl="http://eressea.upb.de/cgi-bin/eressea/poll2001.py"
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+print "Content-Type: text/html\n\n"
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(TemplateFile, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print SubResult[0]
+
+def ReadForm(Form):
+ output=""
+
+ if (Form.has_key('faction') & Form.has_key('password'))==0:
+ Display('Partei oder Passwort nicht angegeben')
+ sys.exit()
+ faction=Form['faction'].value
+ password=Form['password'].value
+ db = MySQLdb.connect(db=dbname)
+ cursor = db.cursor()
+ num = cursor.execute('SELECT password from factions where id=\''+faction+'\' and password=\''+password+'\'')
+ if num==0:
+ Display('Partei oder Passwort ungültig')
+ sys.exit()
+
+ fields="faction"
+ values="'"+faction+"'"
+ booleans=['otherpbem', 'party','othertools','crtools','magellan','emap','ehmv','echeck','vorlage','esurvey','mercator', 'madmax', 'slow', 'fast']
+ for field in booleans:
+ if Form.has_key(field):
+ fields=fields+", "+field
+ values=values+", 1"
+ ints=['age','country','turn','starts','socializer','killer','explorer','achiever']
+ for field in ints:
+ if Form.has_key(field):
+ fields=fields+", "+field
+ values=values+", "+Form[field].value
+ strings=['referer','refererother','fun','toolsother', 'freetext']
+ for field in strings:
+ if Form.has_key(field):
+ fields=fields+", "+field
+ values=values+", '"+Form[field].value+"'"
+ query="REPLACE poll ("+fields+") VALUES ("+values+")"
+ # print query
+ cursor.execute(query)
+
+ Display('Danke für die Teilnahme an der Umfrage.\n
Ergebnisse ansehen\n')
+
+def ShowResult():
+ db = MySQLdb.connect(db=dbname)
+ cursor = db.cursor()
+ results=cursor.execute('SELECT factions.email, poll.freetext, poll.age, countries.name FROM factions, poll, countries WHERE factions.id=poll.faction AND countries.id=poll.country')
+ answers=int(results)
+ ages = {}
+ countries = {}
+ comments = "
Kommentare
\n"
+ while results > 0:
+ results=results-1
+ email, freetext, age, country=cursor.fetchone()
+
+ if freetext!=None:
+ name=""
+# if email==None:
+# email="unknown"
+# name = " ("+re.subn('@', " at ", email)[0]+")"
+ comments=comments+"
"+freetext+name+"\n"
+ if age!=None:
+ if (ages.has_key(age)):
+ ages[age]=ages[age]+1
+ else:
+ ages[age]=1;
+ if country!=None:
+ if (countries.has_key(country)):
+ countries[country]=countries[country]+1
+ else:
+ countries[country]=1;
+
+ personaltext="
Spielerprofil
\n"
+ personals={ 'age': 'Alter', 'turn':'Startrunde', 'starts':'Anzahl Starts'}
+ for key in personals.keys():
+ cursor.execute("SELECT AVG("+key+"), MIN("+key+"), MAX("+key+") FROM poll")
+ kavg, kmin, kmax = cursor.fetchone()
+ personaltext=personaltext+personals[key]+": "+str(int(kmin))+" bis "+str(int(kmax))+" (Durchschnitt "+str(kavg)+") \n"
+ cursor.execute("select count(*) from poll where party=1")
+ value = cursor.fetchone()[0]
+ personaltext=personaltext+str(int(value))+" der "+str(answers)+" Spieler haben schon einmal wegen Eressea eine Party frühzeitig verlassen."
+
+ funtypes= {
+ 'quitting':'Ich höre auf',
+ 'okay':'Geht so',
+ 'greatfun':'Macht großen Spaß',
+ 'bestgame':'Bestes Spiel der Welt'
+ }
+ funtext ="
Spielspaß
\n
\n"
+ for key in funtypes.keys():
+ cursor.execute("SELECT COUNT(*) FROM poll WHERE fun='"+key+"'")
+ value = int(cursor.fetchone()[0])
+ funtext=funtext+"
\n"
+ for tool in toolnames:
+ results=cursor.execute('SELECT count(*) from poll where '+tool+'=1')
+ if results==1:
+ num=int(cursor.fetchone()[0]);
+ tooltext=tooltext+"
"+tool+'
'+str(num)+' ('+str(int(num*100.0/answers))+'%)
\n'
+ tooltext=tooltext+"
...andere
\n"
+ num=cursor.execute("SELECT DISTINCT toolsother FROM poll where toolsother is not null order by toolsother")
+ while num!=0:
+ num=num-1
+ text=str(cursor.fetchone()[0])
+ tooltext=tooltext+text+" \n"
+
+ referernames= {'friends':'Freunde & Familie','pbemdirect':'PBEM Webseiten','other':'Andere', 'otherpbem':'Andere PBEM', 'searchengi':'Suchmaschinen','press':'Presse','yahoo':'Yahoo & Co,' }
+ referertext="
Wie bist Du zu Eressea gekommen?
\n
\n"
+ for referer in referernames.keys():
+ results=cursor.execute("SELECT count(*) from poll where referer='"+referer+"'")
+ if results==1:
+ num=int(cursor.fetchone()[0]);
+ referertext=referertext+"
"+referernames[referer]+'
'+str(num)+"
\n"
+ referertext=referertext+"
...andere
\n"
+ num=cursor.execute("SELECT DISTINCT refererother FROM poll where refererother is not null order by refererother")
+ while num!=0:
+ num=num-1
+ text=str(cursor.fetchone()[0])
+ referertext=referertext+text+" \n"
+
+ scenarionames={'fast':'Zweimal pro Woche','slow':'Alle zwei Wochen','madmax':'Endzeit-Eressea'}
+ scenariotext="
Kommerzielle Szenarios
\n
\n"
+ for scenario in scenarionames.keys():
+ results=cursor.execute('SELECT count(*) from poll where '+scenario+'=1')
+ if results==1:
+ scenariotext=scenariotext+"
"+scenarionames[scenario]+'
'+str(int(cursor.fetchone()[0]))+'
\n'
+ scenariotext=scenariotext+"
\n"
+# agefile=open('poll2001-age.dat', 'w')
+# countryfile=open('poll2001-country.dat', 'w')
+# for age in ages.keys():
+# agefile.write(str(int(age)) + '\t' + str(ages[age]) + '\n')
+ countrytext = "
Heimatländer
\n
"
+ for country in countries.keys():
+# countryfile.write(country + '\t' + str(countries[country]) + '\n')
+ countrytext=countrytext+"
"+country + '
' + str(countries[country]) + '
\n'
+ countrytext=countrytext+"
\n"
+# agefile.close()
+# countryfile.close()
+ Display(personaltext+countrytext+typetext+funtext+scenariotext+referertext+tooltext+comments)
+
+Form = cgi.FieldStorage()
+if Form.has_key('faction'):
+ ReadForm(Form)
+else:
+ ShowResult()
+
+#+--------------+-------------+------+-----+---------+-------+
+#| Field | Type | Null | Key | Default | Extra |
+#+--------------+-------------+------+-----+---------+-------+
+#| faction | varchar(6) | YES | | NULL | |
+#| age | int(11) | YES | | NULL | |
+#| country | int(11) | YES | | NULL | |
+#| turn | int(11) | YES | | NULL | |
+#| starts | int(11) | YES | | NULL | |
+#| otherpbem | tinyint(1) | | | 0 | |
+#| party | tinyint(1) | | | 0 | |
+#| referer | varchar(10) | YES | | NULL | |
+#| refererother | varchar(64) | YES | | NULL | |
+#| fun | varchar(10) | YES | | NULL | |
+#| socializer | int(11) | YES | | NULL | |
+#| killer | int(11) | YES | | NULL | |
+#| explorer | int(11) | YES | | NULL | |
+#| achiever | int(11) | YES | | NULL | |
+#| scenarios | varchar(10) | YES | | NULL | |
+#| magellan | tinyint(1) | | | 0 | |
+#| emap | tinyint(1) | | | 0 | |
+#| ehmv | tinyint(1) | | | 0 | |
+#| vorlage | tinyint(1) | | | 0 | |
+#| esurvey | tinyint(1) | | | 0 | |
+#| mercator | tinyint(1) | | | 0 | |
+#| echeck | tinyint(1) | | | 0 | |
+#| toolsother | varchar(64) | YES | | NULL | |
+#+--------------+-------------+------+-----+---------+-------+
+
diff --git a/scripts/cgi-bin/register.mail.de b/scripts/cgi-bin/register.mail.de
new file mode 100644
index 000000000..d910c47d4
--- /dev/null
+++ b/scripts/cgi-bin/register.mail.de
@@ -0,0 +1,22 @@
+Hallo ,
+
+Du stehst mit deiner Anmeldung bei Eressea auf der Warteliste für neue Parteien
+derzeit an Position . Um Deine Anmeldung zu bestätigen, gehe bitte
+auf die folgende Webseite, und gib dort zur Bestätigung deine Kundennummer
+und den Bestätigungsschlüssel ein.
+
+ http://eressea-pbem.de/confirm.html
+ Kundennummer:
+ Schlüssel:
+
+Um sicherzustellen, das nur interessierte Spieler in der Warteliste sind,
+muß diese Prozedur einmal wöchentlich wiederholt werden. Du bekommst daher
+wöchentlich eine Erinnerungsmail, in der Du auch deine aktuelle Position in
+der Warteliste sehen kannst.
+
+Solltest Du den Schlüssel bis Sonntag früh nicht eingegeben haben, wird
+deine Anmeldung aus der Warteliste entfernt, und Du bekommst keine weiteren
+Mails von uns.
+
+
+Das Eressea-Team
diff --git a/scripts/cgi-bin/register.mail.en b/scripts/cgi-bin/register.mail.en
new file mode 100644
index 000000000..77e6a0b82
--- /dev/null
+++ b/scripts/cgi-bin/register.mail.en
@@ -0,0 +1,20 @@
+Hello ,
+
+You are now entered into the waiting list of Eressea, at position .
+To confirm your subscription, please go to the following URL and enter your
+Customer-ID and confirmation key.
+
+ http://eressea-pbem.de/en/confirm.html
+ Customer ID:
+ Key:
+
+To make sure that only those players interested in playing remain on the
+list, you need to repeat this procedure once every week. We will send you this
+reminder by mail, in which you'll also see your updated position on the
+waiting list.
+
+If you do not enter the key before sunday morning 9:00 CET, your
+registration will be considered cancelled, and you will receive no further
+email from us.
+
+The Eressea Team
diff --git a/scripts/cgi-bin/standin.py b/scripts/cgi-bin/standin.py
new file mode 100755
index 000000000..abcceb691
--- /dev/null
+++ b/scripts/cgi-bin/standin.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+
+import smtplib
+import MySQLdb
+import cgi
+import re
+
+# specify the filename of the template file
+scripturl='http://eressea.upb.de/cgi-bin/eressea/standin.py'
+TemplateFile = "vinyambar.html"
+DefaultTitle = "Vinyambar Parteibörse"
+dbname = "vinyambar"
+From = "accounts@vinyambar.de"
+Errors = ""
+db = MySQLdb.connect(db=dbname)
+smtpserver='localhost'
+notify='accounts@vinyambar.de'
+minnmr=0
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(TemplateFile, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+# for key in Form.keys():
+# Content=Content+" "+str(key)+"="+str(Form[key])
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print "Content-Type: text/html\n\n"
+ print SubResult[0]
+ return
+
+def ShowPage():
+ cursor=db.cursor()
+ maxturn = {}
+ games = cursor.execute("SELECT max(lastturn), game from subscriptions GROUP by game")
+ while games>0:
+ games=games-1
+ lastturn, game = cursor.fetchone()
+ maxturn[game] = lastturn
+ output='
Um eine der folgenden Parteien zu übernehmen, musst du zuerst ein Spielerkonto anlegen. Wenn Du eines hast, markiere die Partei, die Du übernehmen willst, und trage Kundennummer und Kundenpasswort ein.'
+ query = "SELECT g.id, g.name, s.faction, s.lastturn, s.id, r.name, s.info from games g, subscriptions s, races r where s.game=g.id and s.race=r.race and s.status='CANCELLED' order by s.lastturn DESC"
+ results = cursor.execute(query)
+ output=output+'
'
+ Display(output)
+ return
+
+Form = cgi.FieldStorage()
+
+custid=None
+password=None
+if Form.has_key("user"):
+ custid = int(Form["user"].value)
+
+if Form.has_key("pass"):
+ password = Form["pass"].value
+
+if (password!=None) & (custid!=None):
+ cursor=db.cursor()
+ output=""
+ if cursor.execute("select firstname, lastname, email, id from users where password='"+password+"' and id="+str(int(custid)))==1:
+ firstname, lastname, email, custid = cursor.fetchone()
+ c = cursor.execute("SELECT id, game, password, faction, user from subscriptions where status='CANCELLED'")
+ while c>0:
+ c=c-1
+ sid, gid, newpass, faction, uid = cursor.fetchone()
+ if Form.has_key("accept_"+str(int(sid))):
+ update = db.cursor()
+ update.execute("INSERT into transfers (subscription, src, dst, reason) values ("+str(int(sid))+", "+str(int(uid))+", "+str(int(custid))+", 'STANDIN')")
+ update.execute("UPDATE subscriptions set user=" + str(int(custid)) + ", status='ACTIVE' where id=" + str(int(sid)))
+ output=output+"Die Partei " + faction + " wurde Dir überschrieben. Eine Email mit dem Passwort und weiteren Hinweisen ist unterwegs zu Dir. "
+ server=smtplib.SMTP(smtpserver)
+
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: Vinambar Parteiuebernahme\n\n"
+ Msg=Msg+"Das Passwort für deine neue Vinyambar-Partei "+faction+" lautet\n"
+ Msg=Msg+" "+newpass+"\n"
+ Msg=Msg+"\nUm den Report der letzten Woche zu erhalten, schicke eine Mail mit dem Betreff\n"
+ Msg=Msg+"VIN"+str(int(gid))+" REPORT "+faction+" \""+newpass+"\" an die Adresse "
+ Msg=Msg+"vinyambar@eressea.amber.kn-bremen.de"
+ server.sendmail(From, email, Msg)
+
+ Msg="From: "+From+"\nTo: "+notify+"\nSubject: Vinambar Parteiuebernahme\n\n"
+ Msg=Msg+"Die Partei "+faction+" wurde übernommen.\n"
+ Msg=Msg+" Spieler: "+str(int(custid))+"\n"
+ Msg=Msg+" Name : "+firstname+" "+lastname+"\n"
+ Msg=Msg+" email : "+email+"\n"
+ server.sendmail(From, notify, Msg)
+
+ server.close()
+ else:
+ output="Fehler in Passwort oder Kundennummer "
+ Display(output)
+else:
+ ShowPage()
+
+db.close()
diff --git a/scripts/cgi-bin/vinyambar-register.py b/scripts/cgi-bin/vinyambar-register.py
new file mode 100755
index 000000000..39c3a6f99
--- /dev/null
+++ b/scripts/cgi-bin/vinyambar-register.py
@@ -0,0 +1,132 @@
+#!/usr/bin/env python
+
+import sys
+import MySQLdb
+import os
+import cgi
+import re
+import string
+import smtplib
+from whrandom import choice
+
+# specify the filename of the template file
+scripturl="http://eressea.upb.de/cgi-bin/eressea/vinyambar-register.py"
+HTMLTemplate = "vinyambar.html"
+MailTemplate="vinyambar-register.mail"
+DefaultTitle = "Vinyambar Anmeldung"
+dbname = "vinyambar"
+From = "accounts@vinyambar.de"
+locale="de"
+smtpserver = 'localhost'
+db=None
+
+# define a new function called Display
+# it takes one parameter - a string to Display
+def Display(Content, Title=DefaultTitle):
+ TemplateHandle = open(HTMLTemplate, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ # this defines an exception string in case our
+ # template file is messed up
+ BadTemplateException = "There was a problem with the HTML template."
+
+ SubResult = re.subn("", Title, TemplateInput)
+ SubResult = re.subn("", Content, SubResult[0])
+ if SubResult[1] == 0:
+ raise BadTemplateException
+
+ print "Content-Type: text/html\n\n"
+ print SubResult[0]
+ return
+
+
+def Send(email, custid, firstname, password, position):
+ TemplateHandle = open(MailTemplate+"."+locale, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ SubResult = re.subn("", firstname, TemplateInput)
+ SubResult = re.subn("", password, SubResult[0])
+ SubResult = re.subn("", str(int(position)), SubResult[0])
+ SubResult = re.subn("", str(int(custid)), SubResult[0])
+
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: Vinyambar Anmeldung\n\n"
+ Msg=Msg+SubResult[0]
+ server=smtplib.SMTP(smtpserver)
+ server.sendmail(From, email, Msg)
+ server.close()
+ return
+
+
+def GetKey(Form, key):
+ if Form.has_key(key):
+ value=Form[key].value
+ if value!="":
+ return value
+ return None
+
+def ValidEmail(email):
+ if string.find(email, "@")==-1:
+ return 0
+ elif string.find(email, " ")!=-1:
+ return 0
+ return 1
+
+def genpasswd():
+ newpasswd=""
+ chars = string.letters + string.digits
+ for i in range(8):
+ newpasswd = newpasswd + choice(chars)
+ return newpasswd
+
+
+Form = cgi.FieldStorage()
+
+email=GetKey(Form, "email")
+firstname=GetKey(Form, "firstname")
+lastname=GetKey(Form, "lastname")
+address=GetKey(Form, "address")
+city=GetKey(Form, "city")
+country=GetKey(Form, "country")
+phone=GetKey(Form, "phone")
+
+if (locale==None) or (lastname==None) or (firstname==None) or (address==None) or (city==None):
+ output="
Um Dich zu Vinyambar anzumelden musst Du das Formular vollständig ausfüllen.\n "
+ for key in Form.keys():
+ output=output+" "+key+": "+Form[key].value+"\n"
+ Display(output)
+elif ValidEmail(email)==0:
+ output="
Um Dich zu Vinyambar anzumelden musst Du eine gültige Email-Adresse angeben.\n "
+ Display(output)
+else:
+ db=MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+ exist=cursor.execute("select id from users where email='"+email+"'")
+ if exist>0:
+ Display('
Du hast bereits einen Eintrag in der Datenbank.')
+ else:
+ password=genpasswd()
+ fields = "firstname, lastname, locale, email, address, city, status, password"
+ values = "'"+firstname+"', '"+lastname+"', '"+locale+"', '"+email+"', '"+address+"', '"+city+"', 'WAITING', '"+password+"'"
+ if phone!=None:
+ fields=fields+", phone"
+ values=values+", '"+phone+"'"
+ if country!=None:
+ fields=fields+", country"
+ values=values+", "+country+""
+ cursor.execute("insert into users ("+fields+") VALUES ("+values+")")
+ cursor.execute("SELECT LAST_INSERT_ID() from dual")
+ custid=cursor.fetchone()[0]
+ if os.environ.has_key('REMOTE_ADDR'):
+ ip=os.environ['REMOTE_ADDR']
+ if ip!=None:
+ cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
+ cursor.execute("select count(*) from users where status='WAITING' or status='CONFIRMED'")
+ waiting=cursor.fetchone()[0]
+ Send(email, custid, firstname, password, waiting)
+ text={"de":"Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir", "en":"Your application was processed. An email containing further instructions is being sent to you"}
+ Display("
"+text[locale]+".")
+ db.close()
diff --git a/scripts/cvsuser/build.sh b/scripts/cvsuser/build.sh
new file mode 100755
index 000000000..64a3f949b
--- /dev/null
+++ b/scripts/cvsuser/build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+echo "running build.sh"
+module=eressea
+rootdir=/home/cvs/checkout/${module}
+# www=$rootdir/www-data -- no web archives of eressea source
+subdir="source"
+
+date >> ${rootdir}/buildlog
+
+echo ==---------------------==
+echo `date` : Rebuilding ${module}
+echo ==---------------------==
+
+for sub in $subdir
+do
+ # update the source tree
+ cd $rootdir/$sub
+ cvs -q update -drP
+ # create the source archive
+ # cd $rootdir
+ # tar czf ${www}/downloads/${module}-${sub}.tar.gz ${sub}
+done
+cat >| parameters
+${rootdir}/senddiff.pl `cat parameters` 2>&1 >> /tmp/senddiff.log
diff --git a/scripts/cvsuser/commit-source.sh b/scripts/cvsuser/commit-source.sh
new file mode 100755
index 000000000..11518142b
--- /dev/null
+++ b/scripts/cvsuser/commit-source.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+NOTIFY="eressea-design@eressea.kn-bremen.de"
+#NOTIFY="enno@eressea.upb.de"
+NEWFILE="/tmp/commit.source.$$"
+OLDFILE="/tmp/commit.source.last"
+
+BUILDNO=0
+BUILDLOG="/home/cvs/.build/eressea-source.log"
+BUILDFILE="/home/cvs/.build/eressea-source.no"
+if [ -e $BUILDFILE ]; then
+ BUILDNO=`cat $BUILDFILE`
+fi
+
+perl -e '$i=0; while (<>) { if (/^Log Message.*$/) { $i=1; } else { if ($i==1) { print $_; } else { if (/^.*(Tag.*)$/) { print "$1\n\n"; } } } }' >| $NEWFILE
+WHO="$1"
+shift
+
+NEWMD5=`md5sum $NEWFILE | awk '{ print $1 }'`
+echo "New md5sum=$NEWMD5"
+if [ -e $OLDFILE ]; then
+ OLDMD5=`md5sum $OLDFILE | awk '{ print $1 }'`
+else
+ OLDMD5="N/A"
+fi
+cp $NEWFILE $OLDFILE
+echo "Old md5sum=$OLDMD5"
+if [ $NEWMD5 != $OLDMD5 ]; then
+ let BUILDNO=$BUILDNO+1
+ echo $BUILDNO >| $BUILDFILE
+ (
+ echo
+ echo -n "[commit $BUILDNO] $WHO"
+ date
+ cat $NEWFILE
+ ) >> $BUILDLOG
+ mailx -s "[commit $BUILDNO] eressea-source by $WHO" $NOTIFY < $NEWFILE
+ echo "New log message. Sent out notification"
+else
+ echo "Identical log message. Notification skipped"
+fi
+echo $BUILDNO $@ | mailx -s "build eressea" cvs@eressea.upb.de
+rm $NEWFILE
diff --git a/scripts/cvsuser/commit-www.sh b/scripts/cvsuser/commit-www.sh
new file mode 100755
index 000000000..49e8d1313
--- /dev/null
+++ b/scripts/cvsuser/commit-www.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# notify the web user of the change
+mailx -s "update eressea" www-data@eressea.upb.de
diff --git a/scripts/cvsuser/procmailrc b/scripts/cvsuser/procmailrc
new file mode 100644
index 000000000..5ce21714c
--- /dev/null
+++ b/scripts/cvsuser/procmailrc
@@ -0,0 +1,12 @@
+PATH=$HOME/bin:/usr/bin:/public/bin:/bin:/usr/local/bin:/usr/sbin
+ORGMAIL=/var/spool/mail/cvs
+DEFAULT=/var/spool/mail/cvs
+MAILDIR=$HOME/Mail
+LOGFILE=$MAILDIR/procmail-log
+LOCKFILE=$HOME/.lockmail
+VERBOSE=on
+LOGABSTRACT=all
+
+:0:$MAILDIR/.build.lock
+* ^Subject: build \/.*
+| formail -I "" | $HOME/bin/build.sh $MATCH
diff --git a/scripts/cvsuser/senddiff.pl b/scripts/cvsuser/senddiff.pl
new file mode 100755
index 000000000..7380b9425
--- /dev/null
+++ b/scripts/cvsuser/senddiff.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+require Mail::Send;
+
+if(scalar(@ARGV) == 0) {
+ exit();
+}
+
+$msg = new Mail::Send;
+$msg->to('eressea-diff@eressea.upb.de');
+
+# system('cvs update');
+
+$no = shift(@ARGV);
+$dir = shift(@ARGV);
+($project, $dir) = split(/\//, $dir, 2);
+
+$msg->set('Subject', "[commit $no] diff $project/$dir");
+$mail = $msg->open();
+
+print $mail "updated files in $project/$dir\n";
+chdir('/home/cvs/checkout/eressea/$project/$dir');
+
+foreach $arg (@ARGV) {
+ ($file, $oldver, $newver) = split(/,/, $arg);
+ print $mail "COMMAND: cvs diff -u -r $oldver -r $newver $file\n\n";
+ print $mail `cd /home/cvs/checkout/eressea/$project/$dir ; cvs diff -u -r $oldver -r $newver $file`;
+}
+
+$mail->close();
diff --git a/scripts/readme.txt b/scripts/readme.txt
new file mode 100644
index 000000000..dbc31de48
--- /dev/null
+++ b/scripts/readme.txt
@@ -0,0 +1,36 @@
+** Status und Statusänderungen
+
+* USERS.STATUS
+
+NEW: Initialer Status, warten auf Bestätigung der Anmeldung.
+Übergänge:
+-> TUTORIAL, wenn Anmeldung von Benutzer bestätigt wurde.
+-> INVALID, BANNED (nur manuell)
+
+TUTORIAL: Emailadresse des Spielers ist korrekt, seine Anmeldung wurde
+bestätigt, und er muss ein Tutorial bestehen.
+Übergänge:
+-> ACTIVE, wenn er ein Tutorial abgeschlossen hat
+-> INVALID, BANNED (nur manuell)
+
+ACTIVE: Spieler hat das Tutorial erfüllt, und kann sich für Partien anmelden
+Übergänge:
+-> INVALID, BANNED (nur manuell)
+
+INVALID: Spieler hat ungültige Daten übermittelt
+
+BANNED: Spieler ist aus dem Spiel ausgeschlossen worden.
+
+
+* SUBSCRIPTIONS.STATUS
+
+WAITING: Warten auf Bestätigung
+-> EXPIRED
+-> CONFIRMED
+
+CONFIRMED: Bestätigung eingetroffen
+-> WAITING
+-> ACTIVE
+
+ACTIVE: Spiel ist gestartet
+-> DEAD
diff --git a/scripts/register/account-merge.py b/scripts/register/account-merge.py
new file mode 100755
index 000000000..61229a6ff
--- /dev/null
+++ b/scripts/register/account-merge.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# merge two accounts. not used.
+# needs to be checked before used.
+# does not update the TRANSFERS table
+
+import MySQLdb
+import sys
+
+dbname=sys.argv[1]
+userid=int(sys.argv[2])
+oldid=int(sys.argv[3])
+
+db=MySQLdb.connect(db=dbname)
+cursor=db.cursor()
+
+i=cursor.execute("select distinct email from users where id="+str(oldid)+" or id="+str(userid))
+
+if i==0:
+ print "Could not find specified usernames"
+ sys.exit()
+
+if i>1:
+ print "EMail addresses do not match"
+ i=cursor.execute("select id, email from users where id="+str(oldid)+" or id="+str(userid))
+ while i>0:
+ i=i-1
+ id, email = cursor.fetchone()
+ print " "+str(int(id))+" "+email
+ sys.exit()
+
+i=cursor.execute("select id, email, balance from users where id="+str(oldid)+" or id="+str(userid))
+if i!=2:
+ print "Could not find both customer ids"
+ while i>0:
+ i=i-1
+ id, email, balance = cursor.fetchone()
+ print " "+str(int(id))+" "+email
+ sys.exit()
+
+bal=0.0
+while i>0:
+ i=i-1
+ id, email, balance = cursor.fetchone()
+ bal=bal+balance
+
+cursor.execute("update users set balance="+str(bal)+" where id="+str(userid))
+cursor.execute("delete from users where id="+str(oldid))
+cursor.execute("update transactions set user="+str(userid)+" where user="+str(oldid))
+cursor.execute("update subscriptions set user="+str(userid)+" where user="+str(oldid))
+print "Customer records have been merged"
diff --git a/scripts/register/balance.py b/scripts/register/balance.py
new file mode 100755
index 000000000..ef89b8f8b
--- /dev/null
+++ b/scripts/register/balance.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import sys
+import smtplib
+
+From='accounts@vinyambar.de'
+dbname=sys.argv[1]
+
+server=smtplib.SMTP('localhost')
+db=MySQLdb.connect(db=dbname)
+cursor=db.cursor()
+
+i=cursor.execute('SELECT email, balance, firstname, lastname FROM users WHERE balance>0.0')
+
+while i>0:
+ email, balance, firstname, lastname = cursor.fetchone()
+ print 'Balance for '+firstname+' '+lastname+' is '+str(balance)
+ i=i-1
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/billinginfo.py b/scripts/register/billinginfo.py
new file mode 100755
index 000000000..4f2fa6b9a
--- /dev/null
+++ b/scripts/register/billinginfo.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import re
+import sys
+import smtplib
+
+
+dbname=sys.argv[1]
+template=sys.argv[2]
+game=sys.argv[3]
+
+server=smtplib.SMTP('localhost')
+db=MySQLdb.connect(db=dbname)
+From="accounts@vinyambar.de"
+
+cursor=db.cursor()
+query=("select u.id, u.email, u.firstname "+
+ "from users u, games, subscriptions, transactions t "+
+ "where u.id=subscriptions.user and subscriptions.game=games.id and "+
+ "u.status='CONFIRMED' and games.name='"+game+"' GROUP BY u.id HAVING SUM(t.balance)=0")
+
+users=cursor.execute(query)
+print "Sending confirmation to "+str(int(users))+" users"
+while users!=0:
+ users=users-1
+ entry=cursor.fetchone()
+ custid=str(int(entry[0]))
+ email=entry[1]
+ firstname=entry[2]
+
+ infile=open(template,"r")
+ line = infile.read()
+
+ line = re.sub('', custid, line)
+ line = re.sub('', firstname, line)
+ line = re.sub("", game, line)
+
+ Msg = ("From: "+From+"\nTo: "+email+"\n"+
+ "Subject: Vinyambar Kontoinformationen.\n\n"+
+ line)
+
+ try:
+ server.sendmail(From, email, Msg)
+ update=db.cursor()
+ update.execute("UPDATE users set status='PENDING' WHERE id="+custid)
+ print "Sent billing information to "+email
+
+ except:
+ print "Could not inform "+To
+ print "Reason was: '"+Reason+"'"
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+
+ infile.close()
diff --git a/scripts/register/confirm.py b/scripts/register/confirm.py
new file mode 100755
index 000000000..bd7786cb3
--- /dev/null
+++ b/scripts/register/confirm.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+# this script picks all NEW users from the database, (subscribed through
+# the web interface), and sends them their customer-id and password
+# if the mail was sent cuccessfully, it sets the user to the 'WAITING'
+# state, meaning that we wait for his confirmation.
+
+import sys
+import MySQLdb
+import smtplib
+
+dbname=sys.argv[1]
+db = MySQLdb.connect(db=dbname)
+
+From="accounts@vinyambar.de"
+server=smtplib.SMTP('localhost')
+
+cursor=db.cursor()
+records=cursor.execute("SELECT u.id, u.password, u.email "+
+ "from users u "+
+ "where u.status='NEW'")
+
+while records>0:
+ records = records - 1
+ customerid, passwd, email = cursor.fetchone()
+
+ Msg = ("From: "+From+"\nTo: "+email+"\nSubject: Vinyambar Anmeldung angenommen.\n\n"+
+ "Deine Anmeldung für Vinyambar wurde akzeptiert.\n"
+ "\n"+
+ "Kundennummer: " + str(int(customerid)) + "\n"+
+ "Passwort: " + passwd + "\n" +
+ "\n" +
+ "Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das\n"+
+ "Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner \n"+
+ "Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.\n" +
+ "\n"+
+ "Die Kundennummer gib bitte bei der Überweisung der Spielgebühren an. \n" +
+ "Unsere Kontoinformationen lauten:\n" +
+ " Katja Zedel\n"+
+ " Kontonummer 1251 886 106 \n"+
+ " BLZ 500 502 01 (Frankfurter Sparkasse)\n" +
+ "\n"+
+ "Zugang zu deinem Konto erhältst Du mit dem Passowrt auf der Webseite\n"+
+ " http://www.vinyambar.de/accounts.shtml\n"+
+ "\n"+
+ "Das Vinyambar-Team")
+ now = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
+ try:
+ server.sendmail(From, email, Msg)
+ print "[%s] USER %d - UPDATE: status='WAITING' " % (now, customerid)
+ update=db.cursor()
+ update.execute("UPDATE users set status='WAITING' WHERE id="+
+ str(int(customerid)))
+ except:
+ print "[%s] USER %d - ERROR: could not send to %s: %s " % (now, customerid, email, sys.exc_indo())
+ sys.exit()
diff --git a/scripts/register/dbcreate.sql b/scripts/register/dbcreate.sql
new file mode 100644
index 000000000..2a9ace30e
--- /dev/null
+++ b/scripts/register/dbcreate.sql
@@ -0,0 +1,351 @@
+# MySQL dump 8.13
+#
+# Host: localhost Database: vinyambar
+#--------------------------------------------------------
+# Server version 3.23.36-log
+
+#
+# Table structure for table 'countries'
+#
+
+DROP table countries;
+CREATE TABLE countries (
+ id int(11) NOT NULL default '0',
+ name varchar(32) default NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'countries'
+#
+
+INSERT INTO countries VALUES (1,'United States');
+INSERT INTO countries VALUES (10,'Anguilla');
+INSERT INTO countries VALUES (100,'Israel');
+INSERT INTO countries VALUES (101,'Italy');
+INSERT INTO countries VALUES (102,'Jamaica');
+INSERT INTO countries VALUES (103,'Jan Mayen');
+INSERT INTO countries VALUES (104,'Japan');
+INSERT INTO countries VALUES (105,'Jersey');
+INSERT INTO countries VALUES (106,'Jordan');
+INSERT INTO countries VALUES (107,'Kazakhstan');
+INSERT INTO countries VALUES (108,'Kenya Coast Republic');
+INSERT INTO countries VALUES (109,'Kiribati');
+INSERT INTO countries VALUES (11,'Antigua and Barbuda');
+INSERT INTO countries VALUES (111,'Korea, South');
+INSERT INTO countries VALUES (112,'Kuwait');
+INSERT INTO countries VALUES (113,'Kyrgyzstan');
+INSERT INTO countries VALUES (114,'Laos');
+INSERT INTO countries VALUES (115,'Latvia');
+INSERT INTO countries VALUES (116,'Lebanon');
+INSERT INTO countries VALUES (117,'Lesotho');
+INSERT INTO countries VALUES (118,'Liberia');
+INSERT INTO countries VALUES (12,'Argentina');
+INSERT INTO countries VALUES (120,'Liechtenstein');
+INSERT INTO countries VALUES (121,'Lithuania');
+INSERT INTO countries VALUES (122,'Luxembourg');
+INSERT INTO countries VALUES (123,'Macau');
+INSERT INTO countries VALUES (124,'Macedonia');
+INSERT INTO countries VALUES (125,'Madagascar');
+INSERT INTO countries VALUES (126,'Malawi');
+INSERT INTO countries VALUES (127,'Malaysia');
+INSERT INTO countries VALUES (128,'Maldives');
+INSERT INTO countries VALUES (129,'Mali');
+INSERT INTO countries VALUES (13,'Armenia');
+INSERT INTO countries VALUES (130,'Malta');
+INSERT INTO countries VALUES (131,'Marshall Islands');
+INSERT INTO countries VALUES (132,'Martinique');
+INSERT INTO countries VALUES (133,'Mauritania');
+INSERT INTO countries VALUES (134,'Mauritius');
+INSERT INTO countries VALUES (135,'Mayotte');
+INSERT INTO countries VALUES (136,'Mexico');
+INSERT INTO countries VALUES (137,'Moldova');
+INSERT INTO countries VALUES (138,'Monaco');
+INSERT INTO countries VALUES (139,'Mongolia');
+INSERT INTO countries VALUES (14,'Aruba');
+INSERT INTO countries VALUES (140,'Montserrat');
+INSERT INTO countries VALUES (141,'Morocco');
+INSERT INTO countries VALUES (142,'Mozambique');
+INSERT INTO countries VALUES (143,'Namibia');
+INSERT INTO countries VALUES (144,'Nauru');
+INSERT INTO countries VALUES (145,'Nepal');
+INSERT INTO countries VALUES (146,'Netherlands');
+INSERT INTO countries VALUES (147,'Netherlands Antilles');
+INSERT INTO countries VALUES (148,'New Caledonia');
+INSERT INTO countries VALUES (149,'New Zealand');
+INSERT INTO countries VALUES (15,'Australia');
+INSERT INTO countries VALUES (150,'Nicaragua');
+INSERT INTO countries VALUES (151,'Niger');
+INSERT INTO countries VALUES (152,'Nigeria');
+INSERT INTO countries VALUES (153,'Niue');
+INSERT INTO countries VALUES (154,'Norway');
+INSERT INTO countries VALUES (155,'Oman');
+INSERT INTO countries VALUES (156,'Pakistan');
+INSERT INTO countries VALUES (157,'Palau');
+INSERT INTO countries VALUES (158,'Panama');
+INSERT INTO countries VALUES (159,'Papua New Guinea');
+INSERT INTO countries VALUES (16,'Austria');
+INSERT INTO countries VALUES (160,'Paraguay');
+INSERT INTO countries VALUES (161,'Peru');
+INSERT INTO countries VALUES (162,'Philippines');
+INSERT INTO countries VALUES (163,'Poland');
+INSERT INTO countries VALUES (164,'Portugal');
+INSERT INTO countries VALUES (165,'Puerto Rico');
+INSERT INTO countries VALUES (166,'Qatar');
+INSERT INTO countries VALUES (167,'Romania');
+INSERT INTO countries VALUES (168,'Russian Federation');
+INSERT INTO countries VALUES (169,'Rwanda');
+INSERT INTO countries VALUES (17,'Azerbaijan Republic');
+INSERT INTO countries VALUES (170,'Saint Helena');
+INSERT INTO countries VALUES (171,'Saint Kitts-Nevis');
+INSERT INTO countries VALUES (172,'Saint Lucia');
+INSERT INTO countries VALUES (173,'Saint Pierre and Miquelon');
+INSERT INTO countries VALUES (174,'Saint Vincent and the Grenadines');
+INSERT INTO countries VALUES (175,'San Marino');
+INSERT INTO countries VALUES (176,'Saudi Arabia');
+INSERT INTO countries VALUES (177,'Senegal');
+INSERT INTO countries VALUES (178,'Seychelles');
+INSERT INTO countries VALUES (179,'Sierra Leone');
+INSERT INTO countries VALUES (18,'Bahamas');
+INSERT INTO countries VALUES (180,'Singapore');
+INSERT INTO countries VALUES (181,'Slovakia');
+INSERT INTO countries VALUES (182,'Slovenia');
+INSERT INTO countries VALUES (183,'Solomon Islands');
+INSERT INTO countries VALUES (184,'Somalia');
+INSERT INTO countries VALUES (185,'South Africa');
+INSERT INTO countries VALUES (186,'Spain');
+INSERT INTO countries VALUES (187,'Sri Lanka');
+INSERT INTO countries VALUES (188,'Sudan');
+INSERT INTO countries VALUES (189,'Suriname');
+INSERT INTO countries VALUES (19,'Bahrain');
+INSERT INTO countries VALUES (190,'Svalbard');
+INSERT INTO countries VALUES (191,'Swaziland');
+INSERT INTO countries VALUES (192,'Sweden');
+INSERT INTO countries VALUES (193,'Switzerland');
+INSERT INTO countries VALUES (194,'Syria');
+INSERT INTO countries VALUES (195,'Tahiti');
+INSERT INTO countries VALUES (196,'Taiwan');
+INSERT INTO countries VALUES (197,'Tajikistan');
+INSERT INTO countries VALUES (198,'Tanzania');
+INSERT INTO countries VALUES (199,'Thailand');
+INSERT INTO countries VALUES (2,'Canada');
+INSERT INTO countries VALUES (20,'Bangladesh');
+INSERT INTO countries VALUES (200,'Togo');
+INSERT INTO countries VALUES (201,'Tonga');
+INSERT INTO countries VALUES (202,'Trinidad and Tobago');
+INSERT INTO countries VALUES (203,'Tunisia');
+INSERT INTO countries VALUES (204,'Turkey');
+INSERT INTO countries VALUES (205,'Turkmenistan');
+INSERT INTO countries VALUES (206,'Turks and Caicos Islands');
+INSERT INTO countries VALUES (207,'Tuvalu');
+INSERT INTO countries VALUES (208,'Uganda');
+INSERT INTO countries VALUES (209,'Ukraine');
+INSERT INTO countries VALUES (21,'Barbados');
+INSERT INTO countries VALUES (210,'United Arab Emirates');
+INSERT INTO countries VALUES (211,'Uruguay');
+INSERT INTO countries VALUES (212,'Uzbekistan');
+INSERT INTO countries VALUES (213,'Vanuatu');
+INSERT INTO countries VALUES (214,'Vatican City State');
+INSERT INTO countries VALUES (215,'Venezuela');
+INSERT INTO countries VALUES (216,'Vietnam');
+INSERT INTO countries VALUES (217,'Virgin Islands (U.S.)');
+INSERT INTO countries VALUES (218,'Wallis and Futuna');
+INSERT INTO countries VALUES (219,'Western Sahara');
+INSERT INTO countries VALUES (22,'Belarus');
+INSERT INTO countries VALUES (220,'Western Samoa');
+INSERT INTO countries VALUES (221,'Yemen');
+INSERT INTO countries VALUES (222,'Yugoslavia');
+INSERT INTO countries VALUES (223,'Zambia');
+INSERT INTO countries VALUES (224,'Zimbabwe');
+INSERT INTO countries VALUES (225,'APO/FPO');
+INSERT INTO countries VALUES (226,'Micronesia');
+INSERT INTO countries VALUES (23,'Belgium');
+INSERT INTO countries VALUES (24,'Belize');
+INSERT INTO countries VALUES (25,'Benin');
+INSERT INTO countries VALUES (26,'Bermuda');
+INSERT INTO countries VALUES (27,'Bhutan');
+INSERT INTO countries VALUES (28,'Bolivia');
+INSERT INTO countries VALUES (29,'Bosnia and Herzegovina');
+INSERT INTO countries VALUES (3,'United Kingdom');
+INSERT INTO countries VALUES (30,'Botswana');
+INSERT INTO countries VALUES (31,'Brazil');
+INSERT INTO countries VALUES (32,'British Virgin Islands');
+INSERT INTO countries VALUES (33,'Brunei Darussalam');
+INSERT INTO countries VALUES (34,'Bulgaria');
+INSERT INTO countries VALUES (35,'Burkina Faso');
+INSERT INTO countries VALUES (36,'Burma');
+INSERT INTO countries VALUES (37,'Burundi');
+INSERT INTO countries VALUES (38,'Cambodia');
+INSERT INTO countries VALUES (39,'Cameroon');
+INSERT INTO countries VALUES (4,'Afghanistan');
+INSERT INTO countries VALUES (40,'Cape Verde Islands');
+INSERT INTO countries VALUES (41,'Cayman Islands');
+INSERT INTO countries VALUES (42,'Central African Republic');
+INSERT INTO countries VALUES (43,'Chad');
+INSERT INTO countries VALUES (44,'Chile');
+INSERT INTO countries VALUES (45,'China');
+INSERT INTO countries VALUES (46,'Colombia');
+INSERT INTO countries VALUES (47,'Comoros');
+INSERT INTO countries VALUES (48,'Congo, Democratic Republic of th');
+INSERT INTO countries VALUES (49,'Congo, Republic of the');
+INSERT INTO countries VALUES (5,'Albania');
+INSERT INTO countries VALUES (50,'Cook Islands');
+INSERT INTO countries VALUES (51,'Costa Rica');
+INSERT INTO countries VALUES (52,'Cote d Ivoire (Ivory Coast)');
+INSERT INTO countries VALUES (53,'Croatia, Republic of');
+INSERT INTO countries VALUES (55,'Cyprus');
+INSERT INTO countries VALUES (56,'Czech Republic');
+INSERT INTO countries VALUES (57,'Denmark');
+INSERT INTO countries VALUES (58,'Djibouti');
+INSERT INTO countries VALUES (59,'Dominica');
+INSERT INTO countries VALUES (6,'Algeria');
+INSERT INTO countries VALUES (60,'Dominican Republic');
+INSERT INTO countries VALUES (61,'Ecuador');
+INSERT INTO countries VALUES (62,'Egypt');
+INSERT INTO countries VALUES (63,'El Salvador');
+INSERT INTO countries VALUES (64,'Equatorial Guinea');
+INSERT INTO countries VALUES (65,'Eritrea');
+INSERT INTO countries VALUES (66,'Estonia');
+INSERT INTO countries VALUES (67,'Ethiopia');
+INSERT INTO countries VALUES (68,'Falkland Islands (Islas Malvinas');
+INSERT INTO countries VALUES (69,'Fiji');
+INSERT INTO countries VALUES (7,'American Samoa');
+INSERT INTO countries VALUES (70,'Finland');
+INSERT INTO countries VALUES (71,'France');
+INSERT INTO countries VALUES (72,'French Guiana');
+INSERT INTO countries VALUES (73,'French Polynesia');
+INSERT INTO countries VALUES (74,'Gabon Republic');
+INSERT INTO countries VALUES (75,'Gambia');
+INSERT INTO countries VALUES (76,'Georgia');
+INSERT INTO countries VALUES (77,'Germany');
+INSERT INTO countries VALUES (78,'Ghana');
+INSERT INTO countries VALUES (79,'Gibraltar');
+INSERT INTO countries VALUES (8,'Andorra');
+INSERT INTO countries VALUES (80,'Greece');
+INSERT INTO countries VALUES (81,'Greenland');
+INSERT INTO countries VALUES (82,'Grenada');
+INSERT INTO countries VALUES (83,'Guadeloupe');
+INSERT INTO countries VALUES (84,'Guam');
+INSERT INTO countries VALUES (85,'Guatemala');
+INSERT INTO countries VALUES (86,'Guernsey');
+INSERT INTO countries VALUES (87,'Guinea');
+INSERT INTO countries VALUES (88,'Guinea-Bissau');
+INSERT INTO countries VALUES (89,'Guyana');
+INSERT INTO countries VALUES (9,'Angola');
+INSERT INTO countries VALUES (90,'Haiti');
+INSERT INTO countries VALUES (91,'Honduras');
+INSERT INTO countries VALUES (92,'Hong Kong');
+INSERT INTO countries VALUES (93,'Hungary');
+INSERT INTO countries VALUES (94,'Iceland');
+INSERT INTO countries VALUES (95,'India');
+INSERT INTO countries VALUES (96,'Indonesia');
+INSERT INTO countries VALUES (99,'Ireland');
+
+#
+# Table structure for table 'factions'
+#
+
+DROP table factions;
+CREATE TABLE factions (
+ id varchar(6) NOT NULL default '',
+ game int(11) NOT NULL default '0',
+ email varchar(64) default NULL,
+ banner text,
+ vacation varchar(64) default NULL,
+ password varchar(64) default NULL,
+ name varchar(64) default NULL,
+ user int(11) NOT NULL default '0',
+ vacation_start date default NULL,
+ race varchar(16) default NULL,
+ locale varchar(10) default NULL,
+ lastorders int(11) default NULL,
+ PRIMARY KEY (id,game)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'factions'
+#
+
+
+#
+# Table structure for table 'games'
+#
+
+drop table games;
+CREATE TABLE games (
+ id int(11) NOT NULL auto_increment,
+ name varchar(32) NOT NULL default '',
+ info text,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'games'
+#
+
+INSERT INTO games VALUES (1,'Vinyambar I','Vinyambar nach alten Regeln');
+INSERT INTO games VALUES (2,'Vinyambar II','Vinyambar nach neuen Regeln');
+
+#
+# Table structure for table 'races'
+#
+
+drop table races;
+CREATE TABLE races (
+ locale varchar(10) NOT NULL default '',
+ race varchar(10) NOT NULL default '',
+ name varchar(20) default NULL
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'races'
+#
+
+INSERT INTO races VALUES ('de','GOBLIN','Goblins');
+INSERT INTO races VALUES ('de','DWARF','Zwerge');
+INSERT INTO races VALUES ('de','ELF','Elfen');
+INSERT INTO races VALUES ('de','HALFLING','Halblinge');
+INSERT INTO races VALUES ('de','INSECT','Insekten');
+INSERT INTO races VALUES ('de','AQUARIAN','Meermenschen');
+INSERT INTO races VALUES ('de','HUMAN','Menschen');
+INSERT INTO races VALUES ('de','CAT','Katzen');
+INSERT INTO races VALUES ('de','TROLL','Trolle');
+INSERT INTO races VALUES ('de','ORC','Orks');
+INSERT INTO races VALUES ('de','DEMON','Dämonen');
+
+#
+# Table structure for table 'subscriptions'
+#
+
+drop table subscriptions;
+CREATE TABLE subscriptions (
+ game int(11) NOT NULL default '0',
+ user int(11) NOT NULL default '0',
+ credits int(11) NOT NULL default '0',
+ race varchar(10) default NULL,
+ id int(10) NOT NULL auto_increment,
+ status varchar(10) NOT NULL default 'NEW',
+ updated timestamp(14) NOT NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+
+#
+# Table structure for table 'users'
+#
+
+drop table users;
+CREATE TABLE users (
+ id int(11) NOT NULL auto_increment,
+ email varchar(64) default NULL,
+ info text,
+ address varchar(28) default NULL,
+ city varchar(28) default NULL,
+ country int(11) NOT NULL default '0',
+ phone varchar(32) default NULL,
+ firstname varchar(32) default NULL,
+ lastname varchar(32) default NULL,
+ password varchar(16) NOT NULL default '',
+ updated timestamp(14) NOT NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
diff --git a/scripts/register/duplicates.py b/scripts/register/duplicates.py
new file mode 100755
index 000000000..ab20309f8
--- /dev/null
+++ b/scripts/register/duplicates.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# duplicates.py
+# this script will find users that registered from the same IP,
+# where at least one of them is currenly ACTIVE.
+
+import MySQLdb
+import sys
+
+dbname=sys.argv[1]
+db = MySQLdb.connect(db=dbname)
+cursor = db.cursor()
+dupes = cursor.execute("select count(*) sum, ip from users,userips where users.id=userips.user and status!='EXPIRED' group by ip having sum>1")
+
+while dupes:
+ dupes=dupes-1
+ sum, ip = cursor.fetchone()
+ c = db.cursor()
+ c.execute("select count(*) from users, userips where users.id=userips.user and status='CONFIRMED' and ip='"+ip+"'")
+ (active,) = c.fetchone()
+ if active:
+ users = c.execute("select id, email, firstname, lastname, status from users, userips where userips.user=users.id and ip='"+ip+"'")
+ if users:
+ print ip
+ while users:
+ users=users-1
+ uid, email, firstname, lastname, status = c.fetchone()
+ print "\t"+str(int(uid)) +"("+status+")\t"+firstname+" "+lastname+" <"+email+">"
+ print "\n"
+
diff --git a/scripts/register/errors.py b/scripts/register/errors.py
new file mode 100755
index 000000000..42d5838a2
--- /dev/null
+++ b/scripts/register/errors.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+import smtplib
+import time
+import sys
+import os
+import re
+import locking
+from locking import lock, unlock
+
+From="accounts@vinyambar.de"
+
+# lock the input file:
+lock(sys.argv[1]+'.err',180)
+
+# move input file then unlock it:
+if os.access(sys.argv[1]+'.err', os.F_OK)==0:
+ unlock(sys.argv[1]+'.err')
+ sys.exit();
+
+try:
+ os.rename(sys.argv[1]+'.err', sys.argv[1]+'.tmp')
+finally:
+ unlock(sys.argv[1]+'.err')
+
+infile=open(sys.argv[1]+".tmp", "r")
+server=smtplib.SMTP('localhost')
+#server.set_debuglevel(1)
+
+matchline=re.compile(
+ r"""([^\s]+)\s*([^\n\r]+)*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+
+for line in infile.readlines():
+ match=matchline.match(line)
+ if match!=None:
+ To = match.group(1)
+ Reason = match.group(2)
+ print "ERROR: "+To+": "+Reason
+ Msg = ("From: "+From+"\nTo: "+To+"\nSubject: Vinyambar Anmeldung fehlgeschlagen.\n\n"
+ +"Deine Anmeldung konnte aus folgendem Grund nicht akzeptiert werden:\n "+Reason+"\n")
+ try:
+ server.sendmail(From, To, Msg)
+ except:
+ print "Could not send Error to "+To
+ print "Reason was: '"+Reason+"'"
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+
+os.unlink(sys.argv[1]+".tmp")
+infile.close()
+server.quit()
diff --git a/scripts/register/getfactions.py b/scripts/register/getfactions.py
new file mode 100755
index 000000000..ffd6e005f
--- /dev/null
+++ b/scripts/register/getfactions.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import sys
+import string
+from whrandom import choice
+
+dbname=sys.argv[1]
+maxnum=int(sys.argv[2])
+game_id=0 # eressea is game 0, tutorial is 1
+
+def genpasswd():
+ newpasswd=""
+ chars = string.letters + string.digits
+ for i in range(8):
+ newpasswd = newpasswd + choice(chars)
+ return newpasswd
+
+query = "select distinct u.email, s.id, s.password, 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 s.status='CONFIRMED' and r.race=s.race and s.game="+str(game_id)+" and r.locale='de' order by s.id"
+db=MySQLdb.connect(db=dbname)
+cursor = db.cursor()
+c = db.cursor()
+num=cursor.execute(query)
+if num>maxnum:
+ num=maxnum
+while num:
+ num=num-1
+ email, sid, password, race, locale, bonus = cursor.fetchone()
+ if bonus==None:
+ bonus=0
+ if password==None:
+ password=genpasswd()
+ c.execute("UPDATE subscriptions set password='"+password+"' where id="+str(int(sid)))
+
+ print email+" "+race+" "+locale+" "+str(int(bonus))+" "+password
diff --git a/scripts/register/locking.py b/scripts/register/locking.py
new file mode 100755
index 000000000..daf6c4124
--- /dev/null
+++ b/scripts/register/locking.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import time
+import os
+import stat
+
+def trylock(file):
+ try:
+ os.symlink(file, file+'.lock')
+ except OSError:
+ return 1
+ return 0
+
+def lock(file, timeout=60):
+ locked=1
+ while locked:
+ try:
+ locked=0
+ os.symlink(file, file+'.lock')
+ except:
+ update=os.stat(file+'.lock')[stat.ST_MTIME]
+ now=time.time()
+ if (now > update + timeout):
+ locked=0
+ print "removing stale lockfile "+file+".lock"
+ os.unlink(file+'.lock')
+ else:
+ locked=1
+ print "Waiting for lock on "+file+".lock"
+ time.sleep(20)
+
+def unlock(file):
+ os.unlink(file+'.lock')
+
diff --git a/scripts/register/massmail.py b/scripts/register/massmail.py
new file mode 100755
index 000000000..a2c39e77e
--- /dev/null
+++ b/scripts/register/massmail.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import re
+import sys
+import smtplib
+
+
+dbname=sys.argv[1]
+template=sys.argv[2]
+sql=sys.argv[3]
+
+server=smtplib.SMTP('localhost')
+db=MySQLdb.connect(db=dbname)
+From="accounts@vinyambar.de"
+
+cursor=db.cursor()
+query=("select distinct users.id, users.email, users.firstname "+
+ "from users, games, subscriptions "+
+ "where users.id=subscriptions.user and subscriptions.game=games.id and "+
+ sql)
+
+users=cursor.execute(query)
+print "Sending confirmation to "+str(int(users))+" users"
+while users!=0:
+ users=users-1
+ entry=cursor.fetchone()
+ custid=str(int(entry[0]))
+ email=entry[1]
+ firstname=entry[2]
+
+ infile=open(template,"r")
+ line = infile.read()
+
+ line = re.sub('', custid, line)
+ line = re.sub('', firstname, line)
+# line = re.sub("", game, line)
+
+ Msg = ("From: "+From+"\nTo: "+email+"\n"+
+ line)
+
+ try:
+ server.sendmail(From, email, Msg)
+ update=db.cursor()
+ update.execute("UPDATE users set status='PENDING' WHERE id="+custid)
+ print "Sent billing information to "+email
+
+ except:
+ print "Could not inform "+To
+ print "Reason was: '"+Reason+"'"
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+
+ infile.close()
diff --git a/scripts/register/noowner.sql b/scripts/register/noowner.sql
new file mode 100644
index 000000000..662ad4e6c
--- /dev/null
+++ b/scripts/register/noowner.sql
@@ -0,0 +1,3 @@
+select s.id ID, s.faction Partei, s.race Rasse, s.status Status, g.name Spiel
+ from subscriptions s, games g
+ where s.user=0 and g.id=s.game;
diff --git a/scripts/register/payment.py b/scripts/register/payment.py
new file mode 100755
index 000000000..771b2a875
--- /dev/null
+++ b/scripts/register/payment.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import sys
+import smtplib
+
+From='accounts@vinyambar.de'
+#!/usr/bin/env python
+
+import re
+import MySQLdb
+import sys
+
+def pay(db, userid, email, cash, date, reason='PAYMENT'):
+ cursor=db.cursor()
+ locale="de"
+ cursor.execute("UPDATE users SET status='PAYING' WHERE id="+str(userid));
+
+ cursor.execute('INSERT transactions (user, balance, description, date) VALUES ('+str(userid)+', '+str(cash)+', \''+reason+'\', \''+date+'\')')
+ cursor.execute('SELECT LAST_INSERT_ID() FROM transactions WHERE user='+str(userid));
+ lastid = int(cursor.fetchone()[0])
+ result = cursor.execute('SELECT text FROM descriptions WHERE locale=\''+locale+'\' AND handle=\''+reason+'\'')
+ if result!=0:
+ reason = cursor.fetchone()[0]
+
+ i=cursor.execute('SELECT sum(balance) from transactions WHERE user='+str(userid))
+ balance=cursor.fetchone()[0]
+ if balance==None:
+ balance=0.0
+ Msg = ("From: Vinyambar Buchhaltung <"+From+">\nTo: "+email+"\nSubject: Vinyambar Zahlungseingang.\n\n"+
+ "Kundennummer: "+str(userid)+"\n"+
+ "Eingangsdatum: "+date+"\n"+
+ "Transaktionsnummer: "+str(lastid)+"\n"+
+ "Alter Kontostand: "+str(balance)+" EUR\n"+
+ "Zahlungseingang: "+str(cash)+" EUR\n"+
+ "Neuer Kontostand: "+str(balance+cash)+" EUR\n"+
+ "Verwendungszweck: "+reason+"\n"+
+ "\n"+
+ "Deine Zahlung ist eingegangen und wurde auf dein Spielerkonto verbucht.\n")
+
+ try:
+ server=smtplib.SMTP('localhost')
+ server.sendmail(From, email, Msg)
+ except:
+ print "Could not send confirmation to "+email
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+ return
+
+def charge(ids, balance, kto, blz, date):
+ if len(ids):
+ custids = []
+ db=MySQLdb.connect(db=dbname)
+ cursor = db.cursor()
+ for custid in ids:
+ k = cursor.execute('SELECT firstname, lastname FROM users WHERE id='+str(custid))
+ if k:
+ custids.append(custid)
+ if len(custids)==1:
+ k = cursor.execute('SELECT balance from transactions where USER='+str(custid)+" and description='PAYMENT' and date='"+date+"'")
+ if k:
+ print "user already had a transaction today, not adding it for safety reasons"
+ else:
+ cursor.execute('SELECT email FROM users WHERE users.id='+str(custid))
+ email = cursor.fetchone()[0]
+ pay(db, custid, email, balance, date)
+ return 0
+ else:
+ print "zero or more than one possible customerid found:", custids
+ return -1
+
+def eumel(dbname):
+ balance=None
+ kto=None
+ blz=None
+ date=None
+ zweck=[]
+ ids = []
+ rv=0
+ for line in sys.stdin.readlines():
+ match=re.match('Buchung/Wert.* / ([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9]).*H (.*),(.*) EUR', line)
+ if match!=None:
+ if (balance!=None):
+ r = charge(ids, balance, kto, blz, date)
+ if r!=0:
+ print "FAILED", balance, kto, blz, date, zweck
+ rv=r
+ balance=None
+ kto=None
+ blz=None
+ date=None
+ ids = []
+ date=match.groups()[0]+'-'+match.groups()[1]+'-'+match.groups()[2]
+ balance=float(match.groups()[3]+'.'+match.groups()[4])
+ continue
+ match=re.match(' KTO/BLZ\s*([0-9]*) / ([0-9]*)', line)
+ if match!=None:
+ kto, blz = match.groups()
+ continue
+ match=re.match(' VZweck [0-9] *(.*)', line)
+ if match!=None:
+ zweck.append(line)
+ line=match.groups()[0]
+ while len(line):
+ match = re.match('(.*[^ ]) +(.+)', line)
+ if (match!=None):
+ line, value = match.groups()
+ else:
+ value = line
+ line=''
+ try:
+ custid = int(value)
+ ids.append(custid)
+ except ValueError:
+ continue
+ if (balance):
+ r = charge(ids, balance, kto, blz, date)
+ if r!=0:
+ print "FAILED", balance, kto, blz, date, zweck
+ rv=r
+ return rv
+
+def manual(dbname):
+ userid=sys.argv[2]
+
+ db=MySQLdb.connect(db=dbname)
+ cursor=db.cursor()
+
+ i=cursor.execute('SELECT email, firstname, lastname FROM users, transactions WHERE users.id='+str(userid))
+ if i==0:
+ print "Unknown user "+str(userid)
+ sys.exit()
+
+ email, firstname, lastname = cursor.fetchone()
+ i=cursor.execute('SELECT sum(balance) from transactions WHERE user='+str(userid))
+ balance=cursor.fetchone()[0]
+ if balance==None:
+ balance=0.0
+
+ print 'Balance for '+firstname+' '+lastname+' is '+str(balance)+' EUR'
+
+ if len(sys.argv)>4:
+ cash=float(sys.argv[3])
+ date=sys.argv[4]
+ reason='PAYMENT'
+ if len(sys.argv)>5:
+ reason=sys.argv[5]
+
+ pay(db, int(userid), email, cash, date, reason)
+ print 'New balance is '+str(balance+cash)+' EUR'
+ return
+
+dbname=sys.argv[1]
+if sys.argv[2]=='--eumel':
+ r = eumel(dbname)
+ sys.exit(r)
+else:
+ manual(dbname)
diff --git a/scripts/register/pending.sql b/scripts/register/pending.sql
new file mode 100644
index 000000000..0f76cb7ae
--- /dev/null
+++ b/scripts/register/pending.sql
@@ -0,0 +1 @@
+and users.balance=0 and users.status='PENDING'
diff --git a/scripts/register/races.sql b/scripts/register/races.sql
new file mode 100644
index 000000000..75a7c6bc1
--- /dev/null
+++ b/scripts/register/races.sql
@@ -0,0 +1,10 @@
+select races.name Rasse, count(*) Anmeldungen
+ from races, subscriptions, users
+ where races.race=subscriptions.race and subscriptions.user=users.id
+ group by races.race;
+
+select games.name Spiel, count(*) Anmeldungen
+ from games, subscriptions, users
+ where subscriptions.game=games.id and subscriptions.user=users.id
+ group by game;
+
diff --git a/scripts/register/register.py b/scripts/register/register.py
new file mode 100755
index 000000000..e26ca4a11
--- /dev/null
+++ b/scripts/register/register.py
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+## This script is called when an email from the user arrives
+## in reply to the registration form's confirmation email.
+## It's the first time the user is added to the database.
+
+import MySQLdb
+import sys
+import re
+import string
+from whrandom import choice
+
+import locking
+from locking import lock, unlock
+
+dbname=sys.argv[2]
+db=MySQLdb.connect(db=dbname)
+
+lock(sys.argv[1]+".err")
+errors=open(sys.argv[1]+".err", 'a')
+
+def validrace(race):
+ validraces=('GOBLIN', 'DWARF', 'ELF', 'HALFLING', 'INSECT', 'AQUARIAN', 'HUMAN', 'CAT', 'TROLL', 'ORC', 'DEMON')
+ name = string.upper(str(race))
+ if name in validraces:
+ return name
+ return None
+
+def genpasswd():
+ newpasswd=""
+ chars = string.letters + string.digits
+ for i in range(8):
+ newpasswd = newpasswd + choice(chars)
+ return newpasswd
+
+def error(email, message):
+ errors.write(email + " "+ message+"\n");
+
+matchfrom=re.compile(
+ r"""From ([^\s]*)""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+
+matchfirstname=re.compile(
+ r""".*vorname:\s*([^\n\r]*)""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+firstname=None
+
+matchlastname=re.compile(
+ r""".*nachname:\s*([^\n\r]*)\s*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+lastname=None
+
+matchemail=re.compile(
+ r""".*email:\s*([^\n\r]*)\s*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+email=None
+
+matchaddress=re.compile(
+ r""".*adresse:\s*([^\n\r]*)\s*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+address=None
+
+matchcity=re.compile(
+ r""".*ort:\s*([^\n\r]*)\s*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+city=None
+
+matchcountry=re.compile(
+ r""".*land:\s*([^\n\r]*)""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+country=None
+
+matchphone=re.compile(
+ r""".*telefon:\s*([^\n\r]*)\s*""",
+ re.IGNORECASE | re.DOTALL | re.VERBOSE)
+phone=None
+
+for line in sys.stdin.readlines():
+ match=matchfrom.match(line)
+ if (match!=None):
+ email=match.group(1)
+ continue
+
+ match=matchfirstname.match(line)
+ if (match!=None):
+ firstname=match.group(1)
+ continue
+ match=matchlastname.match(line)
+ if (match!=None):
+ lastname=match.group(1)
+ continue
+ match=matchemail.match(line)
+ if (match!=None):
+ email=match.group(1)
+ continue
+ match=matchaddress.match(line)
+ if (match!=None):
+ address=match.group(1)
+ continue
+ match=matchcity.match(line)
+ if (match!=None):
+ city=match.group(1)
+ continue
+ match=matchcountry.match(line)
+ if (match!=None):
+ country=match.group(1)
+ continue
+ match=matchphone.match(line)
+ if (match!=None):
+ phone=match.group(1)
+ continue
+
+if email==None:
+ error("enno@eressea.upb.de",
+ "Es wurde keine Emailadresse angegeben: "+firstname+" "+lastname)
+elif (firstname==None):
+ error(email, "Es wurde kein Vorname angegeben")
+elif (lastname==None):
+ error(email, "Es wurde kein Nachname angegeben")
+elif (address==None):
+ error(email, "Es wurde keine Adresse angegeben")
+elif (city==None):
+ error(email, "Es wurde kein Wohnort angegeben")
+elif (country==None):
+ error(email, "Es wurde kein Land angegeben")
+else:
+ if (phone==None):
+ phone = "NULL"
+
+ cursor=db.cursor()
+ cursor.execute("INSERT INTO users (firstname, lastname, email, address, city, phone, country, password) "+
+ "VALUES ('"+firstname+"', '"+lastname+"', '"+email+"', '"+address+"', '"+city+"', '"+phone+"', "+country+", '"+genpasswd()+"')")
+
+ cursor.execute("SELECT LAST_INSERT_ID() from dual")
+ userid=str(int(cursor.fetchone()[0]))
+
+ cursor.execute("INSERT INTO subscriptions (user, game, status) "+
+ "VALUES ("+str(userid)+", 3, 'WAITING')")
+
+errors.close()
+unlock(sys.argv[1]+".err")
diff --git a/scripts/register/sendmail.py b/scripts/register/sendmail.py
new file mode 100755
index 000000000..f4027fc12
--- /dev/null
+++ b/scripts/register/sendmail.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+import MySQLdb
+import re
+import sys
+import smtplib
+
+
+dbname=sys.argv[1]
+template=sys.argv[2]
+state=sys.argv[3]
+tostate=sys.argv[3]
+
+server=smtplib.SMTP('localhost')
+db=MySQLdb.connect(db=dbname)
+From="accounts@vinyambar.de"
+
+cursor=db.cursor()
+query=("select users.id, users.email, users.firstname "+
+ "from users, games, subscriptions "+
+ "where users.id=subscriptions.user and subscriptions.game=games.id and "+
+ "users.balance=0 and users.status='"+state+"'")
+
+users=cursor.execute(query)
+print "Sending confirmation to "+str(int(users))+" users"
+while users!=0:
+ users=users-1
+ custid, email, firstname =cursor.fetchone()
+
+ infile=open(template,"r")
+ line = infile.read()
+
+ line = re.sub('', custid, line)
+ line = re.sub('', firstname, line)
+ line = re.sub("", game, line)
+
+ Msg = ("From: "+From+"\nTo: "+email+"\n"+
+ "Subject: Vinyambar Kontoinformationen.\n\n"+
+ line)
+
+ try:
+ server.sendmail(From, email, Msg)
+ update=db.cursor()
+ update.execute("UPDATE users set status='"+tostate+"' WHERE id="+custid)
+ print "Sent '"+template+"' information to "+email
+
+ except:
+ print "Could not inform "+To
+ print "Reason was: '"+Reason+"'"
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+
+ infile.close()
diff --git a/scripts/register/status.sh b/scripts/register/status.sh
new file mode 100755
index 000000000..29d4bf41c
--- /dev/null
+++ b/scripts/register/status.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# produces a lot of status information about vinyambar.
+
+if [ $# -gt 0 ]; then
+ db="$1"
+else
+ db="vinyambar"
+fi
+echo "Vinyambar I"
+echo
+mysql --table $db -e "source subscriptions-1.sql"
+echo
+echo
+
+echo "Vinyambar II"
+echo
+mysql --table $db -e "source subscriptions-2.sql"
+echo
+echo
+
+echo "Rassenverteilung"
+echo
+mysql --table $db -e "source races.sql"
+echo
+echo
+
+echo "Ausgemusterte Parteien"
+echo
+mysql --table $db -e "source noowner.sql"
+echo
+echo
+
+echo "Überweisung erforderlich"
+echo
+mysql --table $db -e "source unpaid.sql"
+echo
+echo
+
+echo "Parteienverteilung"
+echo
+mysql --table $db -e "source summary.sql"
+echo
+echo
diff --git a/scripts/register/subscriptions-1.sql b/scripts/register/subscriptions-1.sql
new file mode 100644
index 000000000..224dd398e
--- /dev/null
+++ b/scripts/register/subscriptions-1.sql
@@ -0,0 +1,7 @@
+select users.id, left(concat(firstname,' ',lastname, ' <',email,'>'),43) Name, subscriptions.faction Partei, races.name Rasse
+ from users, games, subscriptions, races
+ where subscriptions.user=users.id
+ and games.id=subscriptions.game
+ and subscriptions.race=races.race
+ and games.id=1 and subscriptions.status='ACTIVE'
+ order by subscriptions.id;
diff --git a/scripts/register/subscriptions-2.sql b/scripts/register/subscriptions-2.sql
new file mode 100644
index 000000000..1df60311b
--- /dev/null
+++ b/scripts/register/subscriptions-2.sql
@@ -0,0 +1,7 @@
+select users.id, left(concat(firstname,' ',lastname, ' <',email,'>'),43) Name, subscriptions.faction Partei, races.name Rasse
+ from users, games, subscriptions, races
+ where subscriptions.user=users.id
+ and games.id=subscriptions.game
+ and subscriptions.race=races.race
+ and games.id=2 and subscriptions.status='ACTIVE'
+ order by subscriptions.id;
diff --git a/scripts/register/summary.sql b/scripts/register/summary.sql
new file mode 100644
index 000000000..c8c6cfc58
--- /dev/null
+++ b/scripts/register/summary.sql
@@ -0,0 +1,6 @@
+select count(users.status) Anzahl, subscriptions.status Status, games.name Spiel
+ from users, games, subscriptions
+ where games.id = subscriptions.game
+ and users.id = subscriptions.user
+ group by games.name, subscriptions.status
+ order by subscriptions.game;
diff --git a/scripts/register/test.py b/scripts/register/test.py
new file mode 100755
index 000000000..6c2470860
--- /dev/null
+++ b/scripts/register/test.py
@@ -0,0 +1,14 @@
+import MySQLdb;
+db=MySQLdb.connect(db='vinyambar');
+c=db.cursor()
+users=c.execute('select id from users')
+while users>0:
+ users=users-1
+ c2=db.cursor()
+ user=c.fetchone()[0]
+ a=c2.execute('select id from transactions where user='+str(int(user)))
+ if a>0:
+ c2.execute("update users set status='PAYING' where id="+str(int(user)))
+ else:
+ c2.execute("update users set status='CONFIRMED' where id="+str(int(user)))
+
diff --git a/scripts/register/unpaid.sql b/scripts/register/unpaid.sql
new file mode 100644
index 000000000..e7c80b5d2
--- /dev/null
+++ b/scripts/register/unpaid.sql
@@ -0,0 +1,6 @@
+select distinct u.id ID, concat(s.game, '/', s.faction) Partei, left(concat(firstname,' ',lastname, ' <',email,'>'),43) Name, sum(t.balance) Kontostand
+ from users u, transactions t, subscriptions s
+ where u.id=t.user and u.id=s.user
+ and s.status='ACTIVE'
+ GROUP BY s.faction
+ HAVING Kontostand<5;
diff --git a/scripts/register/users.sql b/scripts/register/users.sql
new file mode 100644
index 000000000..2f6ad36d9
--- /dev/null
+++ b/scripts/register/users.sql
@@ -0,0 +1,6 @@
+select users.id, users.email, users.firstname, users.lastname, users.email, games.name, races.name
+ from users, games, subscriptions, races
+ where subscriptions.user=users.id
+ and games.id=subscriptions.game
+ and subscriptions.race=races.race
+ order by games.id;
diff --git a/scripts/register/vinyambar.py b/scripts/register/vinyambar.py
new file mode 100755
index 000000000..930bb11d8
--- /dev/null
+++ b/scripts/register/vinyambar.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+import sys
+import curses
+import MySQLdb
+
+Footer = "Vinyambar Informationssystem"
+locale = "de"
+dbname = sys.argv[1]
+db = MySQLdb.connect(db=dbname)
+customers = {}
+custid = 0
+stdscr = curses.initscr()
+height, width = stdscr.getmaxyx()
+custinfo = stdscr.subwin(10, width, 0, 0)
+custdetail = stdscr.subwin(10, width, 10, 0)
+
+def refresh_customers():
+ cursor=db.cursor()
+ count=cursor.execute('SELECT id, firstname, lastname FROM users')
+ while count>0:
+ count=count-1
+ cid, firstname, lastname = cursor.fetchone()
+ customers[cid] = (firstname, lastname)
+
+def show_detail():
+ line = 1
+ custdetail.erase()
+ custdetail.border()
+ custdetail.addstr(0, 2, "[ Kontoinformationen ]", curses.A_BOLD)
+ cursor=db.cursor()
+ count = cursor.execute('SELECT games.name, subscriptions.status, races.name FROM games, subscriptions, races WHERE subscriptions.user='+str(custid)+' and subscriptions.race=races.race and races.locale="'+locale+'" and subscriptions.game=games.id')
+ while count>0:
+ count = count-1
+ game, status, race = cursor.fetchone()
+ custdetail.addstr(line, 2, game+' - '+race+' - '+status)
+ line=line+1
+ count = cursor.execute('SELECT balance, description, date FROM transactions WHERE user='+str(custid))
+ line=line+1
+ while count>0:
+ count = count-1
+ balance, description, date = cursor.fetchone()
+ custdetail.addstr(line, 2, str(date)[0:10]+' - '+description+' - '+str(balance)+' EUR')
+ line=line+1
+ custdetail.refresh()
+
+def show_customer():
+ cursor=db.cursor()
+ custinfo.erase()
+ custinfo.border()
+ custinfo.addstr(0, 2, "[ Kundendaten ]", curses.A_BOLD)
+ custinfo.addstr(1, 2, 'Kundennummer: '+str(custid))
+ show_detail()
+ count = cursor.execute('SELECT firstname, lastname, email, address, city, countries.name, phone, info, password, status FROM users, countries WHERE countries.id=users.country AND users.id='+str(custid))
+ if (count!=0):
+ firstname, lastname, email, addr, city, ccode, phone, info, passwd, status = cursor.fetchone()
+ custinfo.addstr(2, 2, 'Name: '+firstname+' '+lastname)
+ custinfo.addstr(3, 2, 'Address: '+addr)
+ custinfo.addstr(4, 2, ' '+city+', '+ccode)
+ custinfo.addstr(5, 2, 'Phone: '+phone)
+ custinfo.addstr(6, 2, 'Password: '+passwd)
+ if info!=None: custinfo.addstr(8, 2, str(info))
+ custinfo.refresh()
+
+def search():
+ global Footer, custid
+ stdscr.addstr(height-1, 0, '/')
+ stdscr.clrtoeol()
+ curses.echo()
+ s = stdscr.getstr()
+ curses.noecho()
+ refresh_customers()
+ try:
+ custid = int(s)
+ except:
+ curses.beep()
+ Footer='Customer #'+s+' was not found'
+
+ if customers.has_key(custid):
+ show_customer()
+ else:
+ curses.beep()
+ Footer='Customer #'+s+' was not found'
+
+
+def next_customer():
+ global custid
+ custid=custid+1
+ show_customer()
+
+def prev_customer():
+ global custid
+ if custid>0:
+ custid=custid-1
+ show_customer()
+
+def main():
+ global Footer
+ branch = { 'q' : None, '/' : search, '+' : next_customer, '-' : prev_customer }
+ while 1:
+ stdscr.addstr(height-1, 0, Footer)
+ stdscr.clrtoeol()
+ stdscr.refresh()
+ key=stdscr.getch()
+ Footer=':'
+ if (key<256) & (key>=0):
+ c = chr(key)
+ if branch.has_key(c):
+ fun=branch[c]
+ if (fun==None):
+ break
+ else:
+ fun()
+ else:
+ Footer='Unknown keycode '+curses.keyname(key)
+ curses.beep()
+
+stdscr.keypad(1)
+curses.noecho()
+curses.cbreak()
+
+try:
+ show_customer()
+ main()
+finally:
+ stdscr.keypad(0)
+ curses.echo()
+ curses.nocbreak()
+ curses.endwin()
diff --git a/scripts/register/vinyambar.sql b/scripts/register/vinyambar.sql
new file mode 100644
index 000000000..f18eec2ba
--- /dev/null
+++ b/scripts/register/vinyambar.sql
@@ -0,0 +1,663 @@
+# MySQL dump 8.13
+#
+# Host: localhost Database: vinyambar
+#--------------------------------------------------------
+# Server version 3.23.36-log
+
+#
+# Table structure for table 'countries'
+#
+
+CREATE TABLE countries (
+ id int(11) NOT NULL default '0',
+ name varchar(32) default NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'countries'
+#
+
+INSERT INTO countries VALUES (1,'United States');
+INSERT INTO countries VALUES (10,'Anguilla');
+INSERT INTO countries VALUES (100,'Israel');
+INSERT INTO countries VALUES (101,'Italy');
+INSERT INTO countries VALUES (102,'Jamaica');
+INSERT INTO countries VALUES (103,'Jan Mayen');
+INSERT INTO countries VALUES (104,'Japan');
+INSERT INTO countries VALUES (105,'Jersey');
+INSERT INTO countries VALUES (106,'Jordan');
+INSERT INTO countries VALUES (107,'Kazakhstan');
+INSERT INTO countries VALUES (108,'Kenya Coast Republic');
+INSERT INTO countries VALUES (109,'Kiribati');
+INSERT INTO countries VALUES (11,'Antigua and Barbuda');
+INSERT INTO countries VALUES (111,'Korea, South');
+INSERT INTO countries VALUES (112,'Kuwait');
+INSERT INTO countries VALUES (113,'Kyrgyzstan');
+INSERT INTO countries VALUES (114,'Laos');
+INSERT INTO countries VALUES (115,'Latvia');
+INSERT INTO countries VALUES (116,'Lebanon');
+INSERT INTO countries VALUES (117,'Lesotho');
+INSERT INTO countries VALUES (118,'Liberia');
+INSERT INTO countries VALUES (12,'Argentina');
+INSERT INTO countries VALUES (120,'Liechtenstein');
+INSERT INTO countries VALUES (121,'Lithuania');
+INSERT INTO countries VALUES (122,'Luxembourg');
+INSERT INTO countries VALUES (123,'Macau');
+INSERT INTO countries VALUES (124,'Macedonia');
+INSERT INTO countries VALUES (125,'Madagascar');
+INSERT INTO countries VALUES (126,'Malawi');
+INSERT INTO countries VALUES (127,'Malaysia');
+INSERT INTO countries VALUES (128,'Maldives');
+INSERT INTO countries VALUES (129,'Mali');
+INSERT INTO countries VALUES (13,'Armenia');
+INSERT INTO countries VALUES (130,'Malta');
+INSERT INTO countries VALUES (131,'Marshall Islands');
+INSERT INTO countries VALUES (132,'Martinique');
+INSERT INTO countries VALUES (133,'Mauritania');
+INSERT INTO countries VALUES (134,'Mauritius');
+INSERT INTO countries VALUES (135,'Mayotte');
+INSERT INTO countries VALUES (136,'Mexico');
+INSERT INTO countries VALUES (137,'Moldova');
+INSERT INTO countries VALUES (138,'Monaco');
+INSERT INTO countries VALUES (139,'Mongolia');
+INSERT INTO countries VALUES (14,'Aruba');
+INSERT INTO countries VALUES (140,'Montserrat');
+INSERT INTO countries VALUES (141,'Morocco');
+INSERT INTO countries VALUES (142,'Mozambique');
+INSERT INTO countries VALUES (143,'Namibia');
+INSERT INTO countries VALUES (144,'Nauru');
+INSERT INTO countries VALUES (145,'Nepal');
+INSERT INTO countries VALUES (146,'Netherlands');
+INSERT INTO countries VALUES (147,'Netherlands Antilles');
+INSERT INTO countries VALUES (148,'New Caledonia');
+INSERT INTO countries VALUES (149,'New Zealand');
+INSERT INTO countries VALUES (15,'Australia');
+INSERT INTO countries VALUES (150,'Nicaragua');
+INSERT INTO countries VALUES (151,'Niger');
+INSERT INTO countries VALUES (152,'Nigeria');
+INSERT INTO countries VALUES (153,'Niue');
+INSERT INTO countries VALUES (154,'Norway');
+INSERT INTO countries VALUES (155,'Oman');
+INSERT INTO countries VALUES (156,'Pakistan');
+INSERT INTO countries VALUES (157,'Palau');
+INSERT INTO countries VALUES (158,'Panama');
+INSERT INTO countries VALUES (159,'Papua New Guinea');
+INSERT INTO countries VALUES (16,'Austria');
+INSERT INTO countries VALUES (160,'Paraguay');
+INSERT INTO countries VALUES (161,'Peru');
+INSERT INTO countries VALUES (162,'Philippines');
+INSERT INTO countries VALUES (163,'Poland');
+INSERT INTO countries VALUES (164,'Portugal');
+INSERT INTO countries VALUES (165,'Puerto Rico');
+INSERT INTO countries VALUES (166,'Qatar');
+INSERT INTO countries VALUES (167,'Romania');
+INSERT INTO countries VALUES (168,'Russian Federation');
+INSERT INTO countries VALUES (169,'Rwanda');
+INSERT INTO countries VALUES (17,'Azerbaijan Republic');
+INSERT INTO countries VALUES (170,'Saint Helena');
+INSERT INTO countries VALUES (171,'Saint Kitts-Nevis');
+INSERT INTO countries VALUES (172,'Saint Lucia');
+INSERT INTO countries VALUES (173,'Saint Pierre and Miquelon');
+INSERT INTO countries VALUES (174,'Saint Vincent and the Grenadines');
+INSERT INTO countries VALUES (175,'San Marino');
+INSERT INTO countries VALUES (176,'Saudi Arabia');
+INSERT INTO countries VALUES (177,'Senegal');
+INSERT INTO countries VALUES (178,'Seychelles');
+INSERT INTO countries VALUES (179,'Sierra Leone');
+INSERT INTO countries VALUES (18,'Bahamas');
+INSERT INTO countries VALUES (180,'Singapore');
+INSERT INTO countries VALUES (181,'Slovakia');
+INSERT INTO countries VALUES (182,'Slovenia');
+INSERT INTO countries VALUES (183,'Solomon Islands');
+INSERT INTO countries VALUES (184,'Somalia');
+INSERT INTO countries VALUES (185,'South Africa');
+INSERT INTO countries VALUES (186,'Spain');
+INSERT INTO countries VALUES (187,'Sri Lanka');
+INSERT INTO countries VALUES (188,'Sudan');
+INSERT INTO countries VALUES (189,'Suriname');
+INSERT INTO countries VALUES (19,'Bahrain');
+INSERT INTO countries VALUES (190,'Svalbard');
+INSERT INTO countries VALUES (191,'Swaziland');
+INSERT INTO countries VALUES (192,'Sweden');
+INSERT INTO countries VALUES (193,'Switzerland');
+INSERT INTO countries VALUES (194,'Syria');
+INSERT INTO countries VALUES (195,'Tahiti');
+INSERT INTO countries VALUES (196,'Taiwan');
+INSERT INTO countries VALUES (197,'Tajikistan');
+INSERT INTO countries VALUES (198,'Tanzania');
+INSERT INTO countries VALUES (199,'Thailand');
+INSERT INTO countries VALUES (2,'Canada');
+INSERT INTO countries VALUES (20,'Bangladesh');
+INSERT INTO countries VALUES (200,'Togo');
+INSERT INTO countries VALUES (201,'Tonga');
+INSERT INTO countries VALUES (202,'Trinidad and Tobago');
+INSERT INTO countries VALUES (203,'Tunisia');
+INSERT INTO countries VALUES (204,'Turkey');
+INSERT INTO countries VALUES (205,'Turkmenistan');
+INSERT INTO countries VALUES (206,'Turks and Caicos Islands');
+INSERT INTO countries VALUES (207,'Tuvalu');
+INSERT INTO countries VALUES (208,'Uganda');
+INSERT INTO countries VALUES (209,'Ukraine');
+INSERT INTO countries VALUES (21,'Barbados');
+INSERT INTO countries VALUES (210,'United Arab Emirates');
+INSERT INTO countries VALUES (211,'Uruguay');
+INSERT INTO countries VALUES (212,'Uzbekistan');
+INSERT INTO countries VALUES (213,'Vanuatu');
+INSERT INTO countries VALUES (214,'Vatican City State');
+INSERT INTO countries VALUES (215,'Venezuela');
+INSERT INTO countries VALUES (216,'Vietnam');
+INSERT INTO countries VALUES (217,'Virgin Islands (U.S.)');
+INSERT INTO countries VALUES (218,'Wallis and Futuna');
+INSERT INTO countries VALUES (219,'Western Sahara');
+INSERT INTO countries VALUES (22,'Belarus');
+INSERT INTO countries VALUES (220,'Western Samoa');
+INSERT INTO countries VALUES (221,'Yemen');
+INSERT INTO countries VALUES (222,'Yugoslavia');
+INSERT INTO countries VALUES (223,'Zambia');
+INSERT INTO countries VALUES (224,'Zimbabwe');
+INSERT INTO countries VALUES (225,'APO/FPO');
+INSERT INTO countries VALUES (226,'Micronesia');
+INSERT INTO countries VALUES (23,'Belgium');
+INSERT INTO countries VALUES (24,'Belize');
+INSERT INTO countries VALUES (25,'Benin');
+INSERT INTO countries VALUES (26,'Bermuda');
+INSERT INTO countries VALUES (27,'Bhutan');
+INSERT INTO countries VALUES (28,'Bolivia');
+INSERT INTO countries VALUES (29,'Bosnia and Herzegovina');
+INSERT INTO countries VALUES (3,'United Kingdom');
+INSERT INTO countries VALUES (30,'Botswana');
+INSERT INTO countries VALUES (31,'Brazil');
+INSERT INTO countries VALUES (32,'British Virgin Islands');
+INSERT INTO countries VALUES (33,'Brunei Darussalam');
+INSERT INTO countries VALUES (34,'Bulgaria');
+INSERT INTO countries VALUES (35,'Burkina Faso');
+INSERT INTO countries VALUES (36,'Burma');
+INSERT INTO countries VALUES (37,'Burundi');
+INSERT INTO countries VALUES (38,'Cambodia');
+INSERT INTO countries VALUES (39,'Cameroon');
+INSERT INTO countries VALUES (4,'Afghanistan');
+INSERT INTO countries VALUES (40,'Cape Verde Islands');
+INSERT INTO countries VALUES (41,'Cayman Islands');
+INSERT INTO countries VALUES (42,'Central African Republic');
+INSERT INTO countries VALUES (43,'Chad');
+INSERT INTO countries VALUES (44,'Chile');
+INSERT INTO countries VALUES (45,'China');
+INSERT INTO countries VALUES (46,'Colombia');
+INSERT INTO countries VALUES (47,'Comoros');
+INSERT INTO countries VALUES (48,'Congo, Democratic Republic of th');
+INSERT INTO countries VALUES (49,'Congo, Republic of the');
+INSERT INTO countries VALUES (5,'Albania');
+INSERT INTO countries VALUES (50,'Cook Islands');
+INSERT INTO countries VALUES (51,'Costa Rica');
+INSERT INTO countries VALUES (52,'Cote d Ivoire (Ivory Coast)');
+INSERT INTO countries VALUES (53,'Croatia, Republic of');
+INSERT INTO countries VALUES (55,'Cyprus');
+INSERT INTO countries VALUES (56,'Czech Republic');
+INSERT INTO countries VALUES (57,'Denmark');
+INSERT INTO countries VALUES (58,'Djibouti');
+INSERT INTO countries VALUES (59,'Dominica');
+INSERT INTO countries VALUES (6,'Algeria');
+INSERT INTO countries VALUES (60,'Dominican Republic');
+INSERT INTO countries VALUES (61,'Ecuador');
+INSERT INTO countries VALUES (62,'Egypt');
+INSERT INTO countries VALUES (63,'El Salvador');
+INSERT INTO countries VALUES (64,'Equatorial Guinea');
+INSERT INTO countries VALUES (65,'Eritrea');
+INSERT INTO countries VALUES (66,'Estonia');
+INSERT INTO countries VALUES (67,'Ethiopia');
+INSERT INTO countries VALUES (68,'Falkland Islands (Islas Malvinas');
+INSERT INTO countries VALUES (69,'Fiji');
+INSERT INTO countries VALUES (7,'American Samoa');
+INSERT INTO countries VALUES (70,'Finland');
+INSERT INTO countries VALUES (71,'France');
+INSERT INTO countries VALUES (72,'French Guiana');
+INSERT INTO countries VALUES (73,'French Polynesia');
+INSERT INTO countries VALUES (74,'Gabon Republic');
+INSERT INTO countries VALUES (75,'Gambia');
+INSERT INTO countries VALUES (76,'Georgia');
+INSERT INTO countries VALUES (77,'Germany');
+INSERT INTO countries VALUES (78,'Ghana');
+INSERT INTO countries VALUES (79,'Gibraltar');
+INSERT INTO countries VALUES (8,'Andorra');
+INSERT INTO countries VALUES (80,'Greece');
+INSERT INTO countries VALUES (81,'Greenland');
+INSERT INTO countries VALUES (82,'Grenada');
+INSERT INTO countries VALUES (83,'Guadeloupe');
+INSERT INTO countries VALUES (84,'Guam');
+INSERT INTO countries VALUES (85,'Guatemala');
+INSERT INTO countries VALUES (86,'Guernsey');
+INSERT INTO countries VALUES (87,'Guinea');
+INSERT INTO countries VALUES (88,'Guinea-Bissau');
+INSERT INTO countries VALUES (89,'Guyana');
+INSERT INTO countries VALUES (9,'Angola');
+INSERT INTO countries VALUES (90,'Haiti');
+INSERT INTO countries VALUES (91,'Honduras');
+INSERT INTO countries VALUES (92,'Hong Kong');
+INSERT INTO countries VALUES (93,'Hungary');
+INSERT INTO countries VALUES (94,'Iceland');
+INSERT INTO countries VALUES (95,'India');
+INSERT INTO countries VALUES (96,'Indonesia');
+INSERT INTO countries VALUES (99,'Ireland');
+
+#
+# Table structure for table 'dual'
+#
+
+CREATE TABLE dual (
+ dual char(1) default NULL
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'dual'
+#
+
+INSERT INTO dual VALUES ('0');
+
+#
+# Table structure for table 'factions'
+#
+
+CREATE TABLE factions (
+ id varchar(6) NOT NULL default '',
+ game int(11) NOT NULL default '0',
+ email varchar(64) default NULL,
+ banner text,
+ vacation varchar(64) default NULL,
+ password varchar(64) default NULL,
+ name varchar(64) default NULL,
+ user int(11) NOT NULL default '0',
+ vacation_start date default NULL,
+ race varchar(16) default NULL,
+ locale varchar(10) default NULL,
+ lastorders int(11) default NULL,
+ PRIMARY KEY (id,game)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'factions'
+#
+
+
+#
+# Table structure for table 'games'
+#
+
+CREATE TABLE games (
+ id int(11) NOT NULL auto_increment,
+ name varchar(32) NOT NULL default '',
+ info text,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'games'
+#
+
+INSERT INTO games VALUES (1,'Vinyambar I','Vinyambar nach alten Regeln');
+INSERT INTO games VALUES (2,'Vinyambar II','Vinyambar nach neuen Regeln');
+INSERT INTO games VALUES (3,'Warteliste','Interessenten für neue Regeln');
+
+#
+# Table structure for table 'races'
+#
+
+CREATE TABLE races (
+ locale varchar(10) NOT NULL default '',
+ race varchar(10) NOT NULL default '',
+ name varchar(20) default NULL
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'races'
+#
+
+INSERT INTO races VALUES ('de','GOBLIN','Goblins');
+INSERT INTO races VALUES ('de','DWARF','Zwerge');
+INSERT INTO races VALUES ('de','ELF','Elfen');
+INSERT INTO races VALUES ('de','HALFLING','Halblinge');
+INSERT INTO races VALUES ('de','INSECT','Insekten');
+INSERT INTO races VALUES ('de','AQUARIAN','Meermenschen');
+INSERT INTO races VALUES ('de','HUMAN','Menschen');
+INSERT INTO races VALUES ('de','CAT','Katzen');
+INSERT INTO races VALUES ('de','TROLL','Trolle');
+INSERT INTO races VALUES ('de','ORC','Orks');
+INSERT INTO races VALUES ('de','DEMON','Dämonen');
+
+#
+# Table structure for table 'subscriptions'
+#
+
+CREATE TABLE subscriptions (
+ game int(11) NOT NULL default '0',
+ user int(11) NOT NULL default '0',
+ race varchar(10) default NULL,
+ id int(10) NOT NULL auto_increment,
+ status varchar(10) NOT NULL default 'NEW',
+ updated timestamp(14) NOT NULL,
+ credits int(11) NOT NULL default '0',
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'subscriptions'
+#
+
+INSERT INTO subscriptions VALUES (1,4,'ELF',4,'CONFIRMED',20011106230004,0);
+INSERT INTO subscriptions VALUES (1,2,'HUMAN',2,'CONFIRMED',20011106224055,0);
+INSERT INTO subscriptions VALUES (1,3,'DWARF',3,'CONFIRMED',20011106224055,0);
+INSERT INTO subscriptions VALUES (1,5,'HALFLING',5,'CONFIRMED',20011106230004,0);
+INSERT INTO subscriptions VALUES (1,6,'DWARF',6,'CONFIRMED',20011106231004,0);
+INSERT INTO subscriptions VALUES (1,7,'ELF',7,'CONFIRMED',20011106231504,0);
+INSERT INTO subscriptions VALUES (1,8,'TROLL',8,'CONFIRMED',20011106232003,0);
+INSERT INTO subscriptions VALUES (1,9,'DWARF',9,'CONFIRMED',20011106233004,0);
+INSERT INTO subscriptions VALUES (1,10,'ELF',10,'CONFIRMED',20011106233005,0);
+INSERT INTO subscriptions VALUES (1,11,'DWARF',11,'CONFIRMED',20011106233005,0);
+INSERT INTO subscriptions VALUES (2,12,'GOBLIN',12,'CONFIRMED',20011106233505,0);
+INSERT INTO subscriptions VALUES (1,68,'DWARF',78,'CONFIRMED',20011108215504,0);
+INSERT INTO subscriptions VALUES (2,67,'TROLL',77,'CONFIRMED',20011108201004,0);
+INSERT INTO subscriptions VALUES (1,14,'CAT',15,'CONFIRMED',20011107000503,0);
+INSERT INTO subscriptions VALUES (1,15,'ELF',16,'CONFIRMED',20011107002509,0);
+INSERT INTO subscriptions VALUES (2,15,'HALFLING',17,'CONFIRMED',20011107013618,0);
+INSERT INTO subscriptions VALUES (2,18,'AQUARIAN',18,'CONFIRMED',20011107085504,0);
+INSERT INTO subscriptions VALUES (1,19,'DEMON',19,'CONFIRMED',20011107085504,0);
+INSERT INTO subscriptions VALUES (2,19,'AQUARIAN',20,'CONFIRMED',20011107085504,0);
+INSERT INTO subscriptions VALUES (2,20,'ELF',21,'CONFIRMED',20011107085504,0);
+INSERT INTO subscriptions VALUES (2,21,'CAT',22,'CONFIRMED',20011111220350,0);
+INSERT INTO subscriptions VALUES (1,22,'HALFLING',23,'CONFIRMED',20011107095504,0);
+INSERT INTO subscriptions VALUES (2,23,'DEMON',24,'CONFIRMED',20011107105009,0);
+INSERT INTO subscriptions VALUES (2,24,'AQUARIAN',25,'CONFIRMED',20011107105504,0);
+INSERT INTO subscriptions VALUES (2,25,'DWARF',26,'CONFIRMED',20011107110503,0);
+INSERT INTO subscriptions VALUES (2,26,'AQUARIAN',27,'CONFIRMED',20011107114004,0);
+INSERT INTO subscriptions VALUES (1,27,'ELF',28,'CONFIRMED',20011107120503,0);
+INSERT INTO subscriptions VALUES (2,27,'CAT',29,'CONFIRMED',20011107120503,0);
+INSERT INTO subscriptions VALUES (1,28,'HUMAN',30,'CONFIRMED',20011107121506,0);
+INSERT INTO subscriptions VALUES (1,29,'AQUARIAN',31,'CONFIRMED',20011107122004,0);
+INSERT INTO subscriptions VALUES (2,29,'AQUARIAN',32,'CONFIRMED',20011107122004,0);
+INSERT INTO subscriptions VALUES (2,30,'HALFLING',33,'CONFIRMED',20011107123504,0);
+INSERT INTO subscriptions VALUES (1,31,'TROLL',34,'CONFIRMED',20011107135004,0);
+INSERT INTO subscriptions VALUES (2,32,'TROLL',35,'CONFIRMED',20011107143508,0);
+INSERT INTO subscriptions VALUES (2,33,'DEMON',36,'CONFIRMED',20011107152006,0);
+INSERT INTO subscriptions VALUES (2,34,'ELF',37,'CONFIRMED',20011107154504,0);
+INSERT INTO subscriptions VALUES (2,35,'DWARF',38,'CONFIRMED',20011107154504,0);
+INSERT INTO subscriptions VALUES (2,36,'AQUARIAN',39,'CONFIRMED',20011107160504,0);
+INSERT INTO subscriptions VALUES (2,37,'GOBLIN',40,'CONFIRMED',20011107161008,0);
+INSERT INTO subscriptions VALUES (2,38,'CAT',41,'CONFIRMED',20011107163023,0);
+INSERT INTO subscriptions VALUES (2,39,'HUMAN',42,'CONFIRMED',20011107164505,0);
+INSERT INTO subscriptions VALUES (2,40,'ORC',43,'CONFIRMED',20011107171004,0);
+INSERT INTO subscriptions VALUES (2,41,'DWARF',44,'CONFIRMED',20011107173004,0);
+INSERT INTO subscriptions VALUES (2,42,'DEMON',45,'CONFIRMED',20011107184004,0);
+INSERT INTO subscriptions VALUES (2,43,'INSECT',46,'CONFIRMED',20011107190504,0);
+INSERT INTO subscriptions VALUES (2,44,'AQUARIAN',47,'CONFIRMED',20011107200004,0);
+INSERT INTO subscriptions VALUES (1,45,'DWARF',48,'CONFIRMED',20011107201504,0);
+INSERT INTO subscriptions VALUES (2,45,'AQUARIAN',49,'CONFIRMED',20011107201504,0);
+INSERT INTO subscriptions VALUES (2,46,'INSECT',50,'CONFIRMED',20011107202504,0);
+INSERT INTO subscriptions VALUES (2,47,'CAT',51,'CONFIRMED',20011107203004,0);
+INSERT INTO subscriptions VALUES (1,48,'TROLL',52,'CONFIRMED',20011107203508,0);
+INSERT INTO subscriptions VALUES (2,48,'DWARF',53,'CONFIRMED',20011107203509,0);
+INSERT INTO subscriptions VALUES (1,49,'ELF',54,'CONFIRMED',20011107213503,0);
+INSERT INTO subscriptions VALUES (2,50,'HUMAN',55,'CONFIRMED',20011107222003,0);
+INSERT INTO subscriptions VALUES (2,51,'AQUARIAN',56,'CONFIRMED',20011107223504,0);
+INSERT INTO subscriptions VALUES (1,52,'TROLL',57,'CONFIRMED',20011107223504,0);
+INSERT INTO subscriptions VALUES (2,52,'HUMAN',58,'CONFIRMED',20011107223504,0);
+INSERT INTO subscriptions VALUES (1,53,'HUMAN',59,'CONFIRMED',20011107223504,0);
+INSERT INTO subscriptions VALUES (2,53,'HUMAN',60,'CONFIRMED',20011107223505,0);
+INSERT INTO subscriptions VALUES (1,54,'DWARF',61,'CONFIRMED',20011107234505,0);
+INSERT INTO subscriptions VALUES (1,55,'HUMAN',62,'CONFIRMED',20011108001003,0);
+INSERT INTO subscriptions VALUES (2,56,'TROLL',63,'CONFIRMED',20011108023507,0);
+INSERT INTO subscriptions VALUES (1,57,'AQUARIAN',64,'CONFIRMED',20011108095504,0);
+INSERT INTO subscriptions VALUES (2,58,'HUMAN',65,'CONFIRMED',20011108124503,0);
+INSERT INTO subscriptions VALUES (2,59,'DWARF',66,'CONFIRMED',20011108153006,0);
+INSERT INTO subscriptions VALUES (2,60,'DWARF',67,'CONFIRMED',20011108154504,0);
+INSERT INTO subscriptions VALUES (2,61,'INSECT',68,'CONFIRMED',20011108165505,0);
+INSERT INTO subscriptions VALUES (1,62,'HALFLING',69,'CONFIRMED',20011108183504,0);
+INSERT INTO subscriptions VALUES (2,62,'ELF',70,'CONFIRMED',20011108183504,0);
+INSERT INTO subscriptions VALUES (1,63,'DEMON',71,'CONFIRMED',20011108183504,0);
+INSERT INTO subscriptions VALUES (2,63,'ELF',72,'CONFIRMED',20011108183504,0);
+INSERT INTO subscriptions VALUES (1,64,'INSECT',73,'CONFIRMED',20011108185004,0);
+INSERT INTO subscriptions VALUES (2,65,'DWARF',74,'CONFIRMED',20011108192503,0);
+INSERT INTO subscriptions VALUES (1,66,'DWARF',75,'CONFIRMED',20011108195504,0);
+INSERT INTO subscriptions VALUES (2,66,'ELF',76,'CONFIRMED',20011108195505,0);
+INSERT INTO subscriptions VALUES (2,69,'INSECT',79,'CONFIRMED',20011108220003,0);
+INSERT INTO subscriptions VALUES (2,70,'HALFLING',80,'CONFIRMED',20011108222503,0);
+INSERT INTO subscriptions VALUES (1,71,'DWARF',81,'CONFIRMED',20011108224013,0);
+INSERT INTO subscriptions VALUES (1,72,'GOBLIN',82,'CONFIRMED',20011108224503,0);
+INSERT INTO subscriptions VALUES (2,72,'DWARF',83,'CONFIRMED',20011108224503,0);
+INSERT INTO subscriptions VALUES (1,73,'TROLL',84,'CONFIRMED',20011108225004,0);
+INSERT INTO subscriptions VALUES (1,74,'HUMAN',85,'CONFIRMED',20011109070003,0);
+INSERT INTO subscriptions VALUES (2,74,'HUMAN',86,'CONFIRMED',20011109070004,0);
+INSERT INTO subscriptions VALUES (2,75,'DWARF',87,'CONFIRMED',20011109094004,0);
+INSERT INTO subscriptions VALUES (2,76,'ELF',88,'CONFIRMED',20011109094504,0);
+INSERT INTO subscriptions VALUES (1,77,'ELF',89,'CONFIRMED',20011109094504,0);
+INSERT INTO subscriptions VALUES (2,78,'DWARF',90,'CONFIRMED',20011109103504,0);
+INSERT INTO subscriptions VALUES (2,79,'ORC',91,'CONFIRMED',20011109105004,0);
+INSERT INTO subscriptions VALUES (2,80,'DEMON',92,'CONFIRMED',20011109121504,0);
+INSERT INTO subscriptions VALUES (2,81,'INSECT',93,'CONFIRMED',20011109131003,0);
+INSERT INTO subscriptions VALUES (2,82,'DEMON',94,'CONFIRMED',20011109144004,0);
+INSERT INTO subscriptions VALUES (2,83,'CAT',95,'CONFIRMED',20011109145004,0);
+INSERT INTO subscriptions VALUES (2,84,'AQUARIAN',96,'CONFIRMED',20011109190003,0);
+INSERT INTO subscriptions VALUES (2,85,'GOBLIN',97,'CONFIRMED',20011109210506,0);
+INSERT INTO subscriptions VALUES (1,86,'GOBLIN',98,'CONFIRMED',20011109215004,0);
+INSERT INTO subscriptions VALUES (2,87,'ELF',99,'CONFIRMED',20011110115504,0);
+INSERT INTO subscriptions VALUES (2,88,'AQUARIAN',100,'CONFIRMED',20011110121004,0);
+INSERT INTO subscriptions VALUES (2,89,'TROLL',101,'CONFIRMED',20011110130504,0);
+INSERT INTO subscriptions VALUES (1,90,'DWARF',102,'CONFIRMED',20011110142021,0);
+INSERT INTO subscriptions VALUES (2,90,'DWARF',103,'CONFIRMED',20011110142021,0);
+INSERT INTO subscriptions VALUES (2,91,'AQUARIAN',104,'CONFIRMED',20011110142504,0);
+INSERT INTO subscriptions VALUES (1,93,'GOBLIN',106,'CONFIRMED',20011110152005,0);
+INSERT INTO subscriptions VALUES (1,94,'HALFLING',107,'CONFIRMED',20011110152005,0);
+INSERT INTO subscriptions VALUES (2,95,'HALFLING',108,'CONFIRMED',20011110155005,0);
+INSERT INTO subscriptions VALUES (2,96,'ELF',109,'CONFIRMED',20011110160003,0);
+INSERT INTO subscriptions VALUES (1,97,'DEMON',110,'CONFIRMED',20011110180504,0);
+INSERT INTO subscriptions VALUES (2,97,'HALFLING',111,'CONFIRMED',20011110180504,0);
+INSERT INTO subscriptions VALUES (1,98,'ORC',112,'CONFIRMED',20011110190508,0);
+INSERT INTO subscriptions VALUES (2,99,'AQUARIAN',113,'CONFIRMED',20011110201003,0);
+INSERT INTO subscriptions VALUES (1,100,'ELF',114,'CONFIRMED',20011110202005,0);
+INSERT INTO subscriptions VALUES (2,101,'HUMAN',115,'CONFIRMED',20011110204505,0);
+INSERT INTO subscriptions VALUES (2,102,'DEMON',116,'CONFIRMED',20011111111504,0);
+INSERT INTO subscriptions VALUES (2,103,'DWARF',117,'CONFIRMED',20011111113004,0);
+INSERT INTO subscriptions VALUES (1,104,'ELF',118,'CONFIRMED',20011111140003,0);
+INSERT INTO subscriptions VALUES (1,105,'TROLL',119,'CONFIRMED',20011111141504,0);
+INSERT INTO subscriptions VALUES (2,106,'DEMON',120,'CONFIRMED',20011111144505,0);
+INSERT INTO subscriptions VALUES (2,107,'ELF',121,'CONFIRMED',20011111161507,0);
+INSERT INTO subscriptions VALUES (2,108,'AQUARIAN',122,'CONFIRMED',20011111162004,0);
+INSERT INTO subscriptions VALUES (2,109,'INSECT',123,'CONFIRMED',20011111163004,0);
+INSERT INTO subscriptions VALUES (1,110,'INSECT',124,'CONFIRMED',20011111164510,0);
+INSERT INTO subscriptions VALUES (1,111,'HALFLING',125,'CONFIRMED',20011111185004,0);
+INSERT INTO subscriptions VALUES (2,111,'DEMON',126,'CONFIRMED',20011111185005,0);
+INSERT INTO subscriptions VALUES (2,112,'AQUARIAN',127,'CONFIRMED',20011111195004,0);
+INSERT INTO subscriptions VALUES (1,114,'ELF',129,'CONFIRMED',20011111202506,0);
+INSERT INTO subscriptions VALUES (2,115,'DWARF',130,'CONFIRMED',20011111214505,0);
+INSERT INTO subscriptions VALUES (1,116,'TROLL',131,'CONFIRMED',20011111225505,0);
+INSERT INTO subscriptions VALUES (2,116,'HALFLING',132,'CONFIRMED',20011111225506,0);
+INSERT INTO subscriptions VALUES (2,117,'DEMON',133,'CONFIRMED',20011112063020,0);
+INSERT INTO subscriptions VALUES (2,118,'TROLL',134,'CONFIRMED',20011112082005,0);
+INSERT INTO subscriptions VALUES (2,119,'HUMAN',135,'CONFIRMED',20011112101504,0);
+INSERT INTO subscriptions VALUES (2,120,'HUMAN',136,'CONFIRMED',20011112103004,0);
+INSERT INTO subscriptions VALUES (1,121,'AQUARIAN',137,'CONFIRMED',20011112103004,0);
+INSERT INTO subscriptions VALUES (2,121,'GOBLIN',138,'CONFIRMED',20011114122718,0);
+INSERT INTO subscriptions VALUES (2,122,'DWARF',139,'CONFIRMED',20011112103004,0);
+INSERT INTO subscriptions VALUES (1,123,'DEMON',140,'CONFIRMED',20011112121504,0);
+INSERT INTO subscriptions VALUES (2,124,'AQUARIAN',141,'CONFIRMED',20011112141504,0);
+INSERT INTO subscriptions VALUES (2,125,'INSECT',142,'CONFIRMED',20011112143003,0);
+INSERT INTO subscriptions VALUES (1,126,'INSECT',143,'CONFIRMED',20011112155004,0);
+INSERT INTO subscriptions VALUES (1,127,'HUMAN',144,'CONFIRMED',20011112170004,0);
+INSERT INTO subscriptions VALUES (2,128,'GOBLIN',145,'CONFIRMED',20011112172503,0);
+INSERT INTO subscriptions VALUES (2,129,'INSECT',146,'CONFIRMED',20011112184504,0);
+INSERT INTO subscriptions VALUES (1,130,'HALFLING',147,'CONFIRMED',20011112204505,0);
+INSERT INTO subscriptions VALUES (2,130,'ELF',148,'CONFIRMED',20011112204505,0);
+INSERT INTO subscriptions VALUES (2,131,'TROLL',149,'CONFIRMED',20011112225503,0);
+INSERT INTO subscriptions VALUES (1,132,'ELF',150,'CONFIRMED',20011113010003,0);
+INSERT INTO subscriptions VALUES (1,133,'ELF',151,'CONFIRMED',20011113013503,0);
+INSERT INTO subscriptions VALUES (2,134,'CAT',152,'CONFIRMED',20011113085504,0);
+INSERT INTO subscriptions VALUES (2,135,'ELF',153,'CONFIRMED',20011113145505,0);
+INSERT INTO subscriptions VALUES (1,136,'ELF',154,'CONFIRMED',20011113151504,0);
+INSERT INTO subscriptions VALUES (2,137,'GOBLIN',155,'CONFIRMED',20011113230507,0);
+INSERT INTO subscriptions VALUES (2,138,'DWARF',156,'CONFIRMED',20011114002504,0);
+INSERT INTO subscriptions VALUES (2,139,'GOBLIN',157,'CONFIRMED',20011114110503,0);
+INSERT INTO subscriptions VALUES (2,140,'DEMON',158,'CONFIRMED',20011114112004,0);
+INSERT INTO subscriptions VALUES (3,141,'DWARF',159,'WAITING',20011114162334,0);
+INSERT INTO subscriptions VALUES (1,142,'INSECT',160,'CONFIRMED',20011116222017,0);
+INSERT INTO subscriptions VALUES (3,143,'HALFLING',161,'WAITING',20011118204013,0);
+
+#
+# Table structure for table 'users'
+#
+
+CREATE TABLE users (
+ id int(11) NOT NULL auto_increment,
+ email varchar(64) default NULL,
+ info text,
+ address varchar(28) default NULL,
+ city varchar(28) default NULL,
+ country int(11) NOT NULL default '0',
+ phone varchar(32) default NULL,
+ firstname varchar(32) default NULL,
+ lastname varchar(32) default NULL,
+ password varchar(16) NOT NULL default '',
+ updated timestamp(14) NOT NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'users'
+#
+
+INSERT INTO users VALUES (4,'stemu@netcologne.de',NULL,'Mendener Str. 9','51105 Kvln',77,'','Stephan','M|ller','MsR675tf',20011106225756);
+INSERT INTO users VALUES (2,'christianemmler@t-online.de',NULL,'Delmestrasse 55','27777 Ganderkesee',77,'04222-7951073','Christian','Emmler','awfUaLOw',20011106223256);
+INSERT INTO users VALUES (3,'R.Pusbatzkies@gmx.de',NULL,'Heideweg 6','03119 Welzow',77,'035751 12823','Rene','Pusbatzkies','4X2eRrsb',20011106224026);
+INSERT INTO users VALUES (5,'meirose@studst.fh-muenster.de',NULL,'Lange Strasse 11','27777 Ganderkesee',77,'','Nils','Meirose','gPG1Simr',20011106233417);
+INSERT INTO users VALUES (6,'alkas@t-online.de',NULL,'Emil-Barth-Str.99','Düsseldorf',77,'','Thomas','Volkmann','cwD7oD6H',20011106230847);
+INSERT INTO users VALUES (7,'rosenhaeger@planet-interkom.de',NULL,'Mühlenbrink 18','Detmold',77,'05231-628338','Dirk','Rosenhäger','OwSKnl97',20011106231428);
+INSERT INTO users VALUES (8,'sibbi@freenet.de',NULL,'Jägersberg 12','24103 Kiel',77,'0431552372','Christopher','Sievers','SachwIuS',20011106231808);
+INSERT INTO users VALUES (9,'michael-steil@t-online.de',NULL,'Im Langgarten 14 A','66687 Wadern',77,'06874/182022','Michael','Steil','r3OHgxAp',20011106232959);
+INSERT INTO users VALUES (10,'DMuenstermann@t-online.de',NULL,'Lärchenstr. 4','45892 Gelsenkirchen',77,'0209 799440','Denise','Münstermann','zcMn5FvU',20011106233000);
+INSERT INTO users VALUES (11,'dvaergynlaender@gmx.de',NULL,'Lärchenstr. 4','45892 Gelsenkirchen',77,'0209 799440','Dirk','Marquardt','ylW7nwOm',20011106233000);
+INSERT INTO users VALUES (12,'D.Axmacher@t-online.de',NULL,'Streuffstr. 46','Emmerich',77,'02828/92003','Daniel','Axmacher','wqpuZzMx',20011106233008);
+INSERT INTO users VALUES (67,'bigkas@newsfactory.net',NULL,'Lechfeldstr. 23b','86316 Friedberg',77,'0821 229 29 12 (ges)','Klaus','Borchert','li1v7r2m',20011108200859);
+INSERT INTO users VALUES (14,'cennaire@gmx.de',NULL,'Im Langgarten 14 A','66687 wadern',77,'','Sabine','Steil','MF6mH6ni',20011107000431);
+INSERT INTO users VALUES (15,'Aerisprojekt@web.de',NULL,'Sundgauer Str. 105R','Berlin',77,'','Immanuel','Völker','ugTXl7Pn',20011107002356);
+INSERT INTO users VALUES (20,'Schrat@t-online.de',NULL,'Wolfinstr. 10','77830 Bühlertal',77,'07223/991569','Jens','Schrader','o7uFqyKF',20011107085420);
+INSERT INTO users VALUES (19,'saressa@celtic-visions.net',NULL,'Geismar Landstr. 9','Göttingen',77,'0551 / 49569266','Thomas','Schmeja','SiocxqZh',20011107085410);
+INSERT INTO users VALUES (18,'Muescha@epost.de',NULL,'Saßnitzer Str. 4','Dresden',77,'','Michael','Sommer','0378RCOT',20011107085255);
+INSERT INTO users VALUES (21,'red@gmx.de',NULL,'Selchower Strasse 28','12049 Berlin',77,'','Mareike','Paluk','IcC3kQ7P',20011107093654);
+INSERT INTO users VALUES (22,'mirco-jabs@gmx.de',NULL,'Am Bollheister 54','47055 Duisburg',77,'','Mirco','Jabs','yREUOJd6',20011107095421);
+INSERT INTO users VALUES (23,'egonaut@web.de',NULL,'Cammannstraße 4','38118 Braunschweig',77,'','Karsten','Schulz','ZSLPdqYW',20011107104844);
+INSERT INTO users VALUES (24,'Santa_Cruz_@web.de',NULL,'Willy-Andreas-Allee 7','76131 Karlsruhe',77,'0178 - 4577630','Andreas','Kreuzer','xaC1vz69',20011107105426);
+INSERT INTO users VALUES (25,'vic@tzi.de',NULL,'Hahnenstr. 21','28309 Bremen',77,'','Victor','Wundersee','Mv7l3PAz',20011107110426);
+INSERT INTO users VALUES (26,'marcelkessels@web.de',NULL,'Bismarckstr. 51','41747 Viersen',77,'02162-574670','Marcel','Kessels','9XRr1bVY',20011107113517);
+INSERT INTO users VALUES (27,'elfpunkt@yahoo.de',NULL,'Kirchheimer Str. 18','69214 Eppelheim',77,'','Dietmar','Fischer','ifEeJPKV',20011107120408);
+INSERT INTO users VALUES (28,'ChiefMUC@gmx.net',NULL,'Josef-Frankl-Strasse 11B','80995 München',77,'','Oliver','Pappalardo','sQNeuVmz',20011107121008);
+INSERT INTO users VALUES (29,'rolf.schmidt@nefkom.net',NULL,'Krugstr 22','90419 Nürnberg',77,'0049 172 8249600','Rolf','Schmidt','pYhJ45ya',20011107121817);
+INSERT INTO users VALUES (30,'Gron-T.kar@gmx.de',NULL,'Hultroper Dorfstraße 19','59510 Lippetal-Hultrop',77,'02527/8362','Dominik','Gösken','6yMUcZE1',20011107123201);
+INSERT INTO users VALUES (31,'roland.engels@web.de',NULL,'17 Lutton Place','Edinburgh EH8 9PD',3,'0044-131-6681134','Roland','Engels','bJLkxYpZ',20011107134618);
+INSERT INTO users VALUES (32,'sahne@tzi.de',NULL,'Hinter dem Gartel 47','OHZ',77,'04791/899006','Daniel','Kühn','JVDBiaGt',20011107143430);
+INSERT INTO users VALUES (33,'michael@kamenz.de',NULL,'Kirchweg 4','01920 Wendischbaselitz',77,'+49 3578 305068','Michael','Möller','jIqBsV1p',20011107151554);
+INSERT INTO users VALUES (34,'wuestenkrieg@gmx.de',NULL,'Hauptstraße 9','02627 Breitendorf',77,'','Falk','Schneider','WJa1IAPy',20011107154137);
+INSERT INTO users VALUES (35,'Sven.Pietschmann@t-online.de',NULL,'Löbauer Str. 64','Beiersdorf',77,'','Sven','Pietschmann','YnryGAD7',20011107154155);
+INSERT INTO users VALUES (36,'520097125011-0001@t-online.de',NULL,'Nollinger Str. 42','79618 Rheinfelden',77,'0173/5215656','Uwe','Müller','AFPd86ap',20011107160339);
+INSERT INTO users VALUES (37,'Schifferb@web.de',NULL,'Pappelstr. 71b','28199 Bremen',77,'0173-5779873','Bernd','Schiffer','uTkG6ild',20011107160859);
+INSERT INTO users VALUES (38,'marten.kollakowski@t-online.de',NULL,'Carl-von-Ossietzky-Str. 3','29126 oldenburg',77,'0441/7779763','Marten','Kollakowski','ZYR9jY5e',20011107162558);
+INSERT INTO users VALUES (39,'Markus.Klawitter@web.de',NULL,'Hoeltyweg 15','49082 Osnabrueck',77,'','Markus','Klawitter','YlB8yB6R',20011107164020);
+INSERT INTO users VALUES (40,'cordesmartin@gmx.de',NULL,'Feldstrasse 79 a','Bremen',77,'0421 77412','Martin','Cordes','6tV8oqQf',20011107170659);
+INSERT INTO users VALUES (41,'marco.vitali@gmx.ch',NULL,'Buechstrasse 18','5445 Eggenwil',193,'++41-(0)56-6316989','Marco','Vitali','T8HSsnWd',20011107172612);
+INSERT INTO users VALUES (42,'moritzsalinger@web.de',NULL,'Obentrautstraße 64','10963 Berlin',77,'0173 97 95 701','Moritz','Salinger','GrfL4jon',20011107183554);
+INSERT INTO users VALUES (43,'christian@decomain.de',NULL,'Spiegelsbergenweg 104A','Halberstadt',77,'+49 179 2155992','Christian','Decomain','s1Fx40y3',20011107190221);
+INSERT INTO users VALUES (44,'ramona@schrepler.de',NULL,'Fritz-Frey-Str. 11','69121 Heidelberg',77,'06221-418010','Ramona','Schrepler','Lacn2Pyv',20011107195559);
+INSERT INTO users VALUES (45,'ARose@nwn.de',NULL,'Walsroder Str.4','28215 Bremen',77,'','Arne','Rose','PrIw8UyY',20011107201347);
+INSERT INTO users VALUES (46,'hbruhns@ix.urz.uni-heidelberg.de',NULL,'Fritz-Frey-Str. 11','69121 Heidelberg',77,'06221 418012','Hjalmar','Bruhns','zwpY7peL',20011107202024);
+INSERT INTO users VALUES (47,'osprung@gmx.de',NULL,'Meißener Str.9','44139 Dortmund',77,'','Oliver','Sprung','xiXDEu9Y',20011107202741);
+INSERT INTO users VALUES (48,'Fam.Spengler@t-online.de',NULL,'Irlenbornerstr. 14','53783 Eitorf',77,'02243 82178','Stephan','Spengler','okdq89vi',20011107203029);
+INSERT INTO users VALUES (49,'gerhard.hecht@deutschlandweb.de',NULL,'Lerchenweg 16','86492 Egling a.d.Paar',77,'08206 / 903178','Gerhard','Hecht','s4ilkbQb',20011107213252);
+INSERT INTO users VALUES (50,'Ralf.Hachmeister@t-online.de',NULL,'Georg-Viktor-Strasse 32','31812 Bad Pyrmont',77,'05281 960074','Ralf','Hachmeister','Rv5dJqqz',20011107221535);
+INSERT INTO users VALUES (51,'gwaylare@gmx.net',NULL,'Leinestr. 2','Göttingen',77,'','Christoph','Albrecht','4Gp89cDU',20011107223151);
+INSERT INTO users VALUES (52,'chennings@talknet.de',NULL,'Kämmerei 40','27749 Delmenhorst',77,'04221121222','Carsten','Hennings','HrPcHFQF',20011107223240);
+INSERT INTO users VALUES (53,'thorsten.bahr@onlinehome.de',NULL,'Harthauser Straße 76','83043 Bad Aibling',77,'','Thorsten','Bahr','NYD9v561',20011107223249);
+INSERT INTO users VALUES (54,'daniel@boiger.com',NULL,'Rechbergstraße 1','73240 Wendlingen',77,'','Daniel','Boiger','sj3ZmEZ6',20011107234225);
+INSERT INTO users VALUES (55,'alerich2@gmx.net',NULL,'Geschwister-Scholl 6','91058 Erlangen',77,'09131/129670','Ulrich','Hofrichter','xntFLV17',20011108000555);
+INSERT INTO users VALUES (56,'Seppel@prof-seppel.de',NULL,'Bayernallee 7','52066 Aachen',77,'','Sebastian','Oliva','fTDKrAhA',20011108023008);
+INSERT INTO users VALUES (57,'helge.hennings@klinik.uni-regensburg.de',NULL,'Placidusstr. 8','93053 Regensburg',77,'0941/7081875','Helge','Hennings','0saimmtE',20011108095242);
+INSERT INTO users VALUES (58,'andre.lerch@gmx.net',NULL,'Salgaer Str. 4','02694 Malschwitz',77,'','Andre','Lerch','npfnFzsF',20011108124045);
+INSERT INTO users VALUES (59,'Volk-von-Condor@web.de',NULL,'Nadistr. 20','80809 München',77,'08151/4442450 oder 089/3573261','Ralf','Jung','o7tYHQtu',20011114122937);
+INSERT INTO users VALUES (60,'raffa@tzi.de',NULL,'Bachstr. 81','28199 Bremen',77,'0421/393981','Raphael','Sturm','WfzzoBNb',20011108154052);
+INSERT INTO users VALUES (61,'moekon@snafu.de',NULL,'JansaStr. 9','12045 Berlin',77,'030 / 62 72 76 84','Thomas','Konnerth','ufKYGIAu',20011108165022);
+INSERT INTO users VALUES (62,'Morgon@Morgon.de',NULL,'Riegelstr. 58','63762 Großostheim',77,'06026/995153','Sebastian','Weigt','ehzZi6iz',20011108183027);
+INSERT INTO users VALUES (63,'Rupalairpel@gmx.de',NULL,'Thüringer Straße 12','63811 Stockstadt',77,'','Andreas','Müller','rS9gevGv',20011108183035);
+INSERT INTO users VALUES (64,'Oglbi@gmx.de',NULL,'Moritzstr.45','55130 Mainz',77,'','Alexander','Schoehl','6kv1s57y',20011108184527);
+INSERT INTO users VALUES (65,'Xolgrim@gmx.de',NULL,'Hugo-Haelschner-Str.2','53129 Bonn',77,'0228/234588','Thomas','Straßberger','r1qBy4Ot',20011108192159);
+INSERT INTO users VALUES (66,'paladin@bluemail.ch',NULL,'Alpenblickweg 17','3034 Uettligen',193,'','Matthias','Regli','KEbsf2EZ',20011108195229);
+INSERT INTO users VALUES (68,'gzech@t-online.de',NULL,'brendelweg 42','27755 Delmenhorst',77,'0422124921','Guido','Zech','FchaKiVy',20011108215045);
+INSERT INTO users VALUES (69,'stephan-heinrich@gmx.net',NULL,'Schnickenfeld 45a','25497 Prisdorf',77,'04101 782875','Stephan','Heinrich','CaYdwCs9',20011108215639);
+INSERT INTO users VALUES (70,'r.m.glade@talknet.de',NULL,'Finsterwalderstraße 39','01239 Dresden',77,'0172/9147817','Matthias','Glade','a6PSYqFH',20011108222348);
+INSERT INTO users VALUES (71,'vinyambar@waldgoettin.de',NULL,'Wehrweg 2','Kelkheim',77,'','Silvia','Tobies','VOgKOw9A',20011108223528);
+INSERT INTO users VALUES (72,'peter.kraus@web.de',NULL,'Heideweg 94','50196 Kerpen',77,'0227369610','Peter','Kraus','nSK0W8q4',20011108224148);
+INSERT INTO users VALUES (73,'cavendish@planet-interkom.de',NULL,'am gelskamp 16a','32758 detmold',77,'','michael','fisahn','2Z36XPjP',20011108224858);
+INSERT INTO users VALUES (74,'ralphknoll@web.de',NULL,'Neutann 1','88364 Wolfegg',77,'','Ralph','Knoll','lC1dRs9P',20011109065601);
+INSERT INTO users VALUES (75,'klaus@lottmann.de',NULL,'Neuenhainerstrasse 10','60326 Frankfurt',77,'01718596589','Klaus','Lottmann','EfW9d4rM',20011109093531);
+INSERT INTO users VALUES (76,'pampala@gmx.de',NULL,'Grenadierweg 15','26129 Oldenburg',77,'0441/2179804','Pan','Pollack','e9aCJ47w',20011109094120);
+INSERT INTO users VALUES (77,'p.biebow@web.de',NULL,'Friedrichstr. 72','68519 Viernheim',77,'0160 3241994','Peter','Biebow','6TIhSjM2',20011109094157);
+INSERT INTO users VALUES (78,'Wilhelm.Dolle@brainmedia.de',NULL,'Cappeler Strasse 21','35039 Marburg',77,'','Wilhelm','Dolle','fufuxstL',20011109103349);
+INSERT INTO users VALUES (79,'grrummpf@web.de',NULL,'Friedrichstr. 6','53757 Hangelar',77,'','Sebastian','Korte','xhBi2P64',20011109104641);
+INSERT INTO users VALUES (80,'genua@snafu.de',NULL,'Winsstr. 22','10405 Berlin',77,'+49 172 3219138','Steffen','Schermaul','DxC9C8JW',20011109121424);
+INSERT INTO users VALUES (81,'vinyambar@zigulle.de',NULL,'Sonnenstr. 232','44137 Dortmund',77,'','Daniel','Frickemeier','3GkZMurN',20011109130637);
+INSERT INTO users VALUES (82,'alexander.metzner@informatik.uni-oldenburg.de',NULL,'Ahornweg 4','26919 Brake',77,'','Alexander','Metzner','F9GVOC2A',20011109143916);
+INSERT INTO users VALUES (83,'Christian.Wachtendorf@Informatik.Uni-Oldenburg.DE',NULL,'Heiligengeistwall 10','26122 Oldenburg',77,'','Christian','Wachtendorf','Qs9xbr5P',20011109144906);
+INSERT INTO users VALUES (84,'mallig@gmx.net',NULL,'Im Laimacker 32','79249 Merzhausen',77,'','Nicolai','Mallig','CFCsxTiL',20011109185952);
+INSERT INTO users VALUES (85,'Carsten.Kaschube@web.de',NULL,'Sigmaringer Str. 52','72622 Nürtingen',77,'','Carsten','Kaschube','3IOR4tQx',20011109210108);
+INSERT INTO users VALUES (86,'thomas-peter.klug@debitel.net',NULL,'Alter heerweg 35','53123 Bonn',77,'','Thomas-Peter','Klug','LYSt6qXS',20011109214720);
+INSERT INTO users VALUES (87,'ahillenb@ix.urz.uni-heidelberg.de',NULL,'Albert-Überle-Str. 10','69120 Heidelberg',77,'06221 408995','Andreas','Hillenbach','LME6LSjq',20011110115209);
+INSERT INTO users VALUES (88,'Xarkor@gmx.net',NULL,'Howaldtstr. 18','24118 Kiel',77,'0431-6409852','Michael','Jabs','jh5buGu3',20011110120628);
+INSERT INTO users VALUES (89,'feibisch@estec.net',NULL,'Lutherstr. 84','07743 Jena',77,'03641/470096','Frank','Eibisch','KH1u5FEA',20011110130129);
+INSERT INTO users VALUES (90,'ottstadt@sevcon.de',NULL,'Hermann-Löns-Weg 11','22848 Norderstedt',77,'040-512086-12','Willy','Ottstadt','NdYUBNQs',20011110141811);
+INSERT INTO users VALUES (91,'Noilaht@web.de',NULL,'Ifteweg 6','58454 Witten',77,'','Thorsten','Engelbrecht','Hyyycvmt',20011110142138);
+INSERT INTO users VALUES (93,'arthurrefinius@web.de',NULL,'Stolberger Str. 68','Aachen',77,'','Arthur','Refinius','MX2xIKNZ',20011110151659);
+INSERT INTO users VALUES (94,'mina_murry@web.de',NULL,'Stolberger Str. 68','Aachen',77,'','Yvonne','Meis','lx5JAobE',20011110151718);
+INSERT INTO users VALUES (95,'Frank-Michael.Zimmer@T-Online.de',NULL,'Ulmenweg 11','25451 Quickborn',77,'04106 / 66297','Frank-Michael','Zimmer','2RvsbXJB',20011110154508);
+INSERT INTO users VALUES (96,'Holger.Gentemann@t-online.de',NULL,'Arminiusstr. 12','22525 Hamburg',77,'0408500103','Holger','Gentemann','2cWGhMhC',20011110155953);
+INSERT INTO users VALUES (97,'enno@eressea.upb.de',NULL,'Huk Aveny 5b','0287 Oslo',154,'','Enno','Rehling','stkxSiHQ',20011110180250);
+INSERT INTO users VALUES (98,'MJimBeam@aol.com',NULL,'Dresdener Ring 1','Hochheim',77,'','Michael','Simon','UzESKxUm',20011110190227);
+INSERT INTO users VALUES (99,'centime@in-trier.de',NULL,'Henneystr.11','54293 Trier',77,'','Carsten','Pfennig','yC43Eob3',20011110200752);
+INSERT INTO users VALUES (100,'stefan@siev.de',NULL,'Emil-von-Behring Str. 21','35041 Marburg',77,'','Stefan','Sievers','gWiiCQCZ',20011110201606);
+INSERT INTO users VALUES (101,'matthias.frost@cityweb.de',NULL,'Zweibachweg 7','45279 Essen',77,'01605035882','Matthias','Frost','QQ9wHAAu',20011110204447);
+INSERT INTO users VALUES (102,'gandalf@informatik.uni-bremen.de',NULL,'Dresdener Str. 1a','28844 Weyhe (bei Bremen)',77,'04203/810797','Cedrik','Duval','WDrEQTW2',20011111111333);
+INSERT INTO users VALUES (103,'aramesvs@t-online.de',NULL,'Hauptstraße 48','Herzberg',77,'05521 2809','Frank','Nolte','4Ydo3fTT',20011111112533);
+INSERT INTO users VALUES (104,'micha@lst.de',NULL,'Naegelsbacherstr. 49c','91052 Erlangen',77,'+49 9131 7192-325','Micha','Istine','kNgy9al3',20011111135542);
+INSERT INTO users VALUES (105,'nilshorstmann@web.de',NULL,'Schwalbenstr. 4','28816 Stuhr',77,'','Nils','Horstmann','1ppXJrWV',20011111141125);
+INSERT INTO users VALUES (106,'Feacor@web.de',NULL,'Nestorstr. 15','10709 Berlin',77,'','Daniel','Kohl','h48VSRLD',20011111144452);
+INSERT INTO users VALUES (107,'boris_schroeder@web.de',NULL,'Kriegerstr. 42','30161 Hannover',77,'05111693916','Boris','Schröder','d3LORqkj',20011111161143);
+INSERT INTO users VALUES (108,'ectorhga@linux.zrz.tu-berlin.de',NULL,'Nestorstr. 15','Berlin',77,'','Alexander','Sahm','vjdfhtOQ',20011111161623);
+INSERT INTO users VALUES (109,'520020001929-0001@T-Online.de',NULL,'Ascher Str. 22','63477 Maintal',77,'','Nick','Sauter','u8rzSQAq',20011111162902);
+INSERT INTO users VALUES (110,'joha_puck@web.de',NULL,'Kastanienstraße 13','24114 Kiel',77,'0431/6686648','Markus Johannes','Puck','ajWhzD34',20011111164353);
+INSERT INTO users VALUES (111,'meini@einsteinfreun.de',NULL,'Auf der Schulenburg 22','33378 Rheda',77,'','Sebastian','Meinhardt','NkFXheZM',20011111184904);
+INSERT INTO users VALUES (112,'Evewan@web.de',NULL,'Belßstraße 81','Berlin',77,'','Thomas','Leue','uxUiWIxE',20011111194928);
+INSERT INTO users VALUES (114,'paul.fuehring@gmx.net',NULL,'Müllerstr. 30','13353 Berlin',77,'','Paul','Führing','OK2sRkAr',20011111202214);
+INSERT INTO users VALUES (115,'Dragoon2913@t-online.de',NULL,'Winkelstr. 16','Herzberg',77,'','Mark','Szemeitat','FmYwtR0G',20011111214036);
+INSERT INTO users VALUES (116,'MMalte@directbox.com',NULL,'Hohenloherstr 39 A','70435 Stuttgart',77,'0173/5938300','Malte','Möller','mKrRMgqo',20011111225156);
+INSERT INTO users VALUES (117,'andreas.hallmann@gecits-eu.com',NULL,'Gröpelinger Heerstr. 301','28239 Bremen',77,'0421-6166311','Andreas','Hallmann','dPjRKZs2',20011112062521);
+INSERT INTO users VALUES (118,'vinyambar@zerofoks.net',NULL,'Taubenstraße 18','28203 Bremen',77,'0421 7940905','Ferdinand','Steiger','9zxMjWDp',20011112081725);
+INSERT INTO users VALUES (119,'gunty@talknet.de',NULL,'Nithackstr. 4','D-10585 Berlin',77,'(030) 347 02 758','Günther','Martinez Dreyer','vLN79XDJ',20011112101441);
+INSERT INTO users VALUES (120,'Karsten.Meier@stim.de',NULL,'Südekumzeile 7a','13591 Berlin',77,'','Karsten','Meier','tdP0FoVr',20011112102722);
+INSERT INTO users VALUES (121,'michael.tuscher@web.de',NULL,'Bussmannsfeld 109','44805 Bochum',77,'','Michael','Tuscher','eBJnJmsR',20011112102904);
+INSERT INTO users VALUES (122,'daniel@boiger.com',NULL,'Rechbergstr. 1','Wendlingen',77,'','Daniel','Boiger','znUOJmZ0',20011112102923);
+INSERT INTO users VALUES (123,'jb559755@rcs.urz.tu-dresden.de',NULL,'Gubener Str. 36','01237 Dresden',77,'0172/3515486','Jens','Bergmann','zxOoiau9',20011112121046);
+INSERT INTO users VALUES (124,'phelan@phelan-net.de',NULL,'Klaushager Weg 17','13467 Berlin',77,'','Rainer','Schüler','uDtnGTSE',20011112141432);
+INSERT INTO users VALUES (125,'Roger.Frehoff@t-online.de',NULL,'Bergheimer Weg 25','Gerlingen',77,'','Roger','Frehoff','FVv0gEJL',20011112142906);
+INSERT INTO users VALUES (126,'Alexander.Miseler@SilverStyle.de',NULL,'Weidenweg 47','10249 Berlin',77,'','Alexander','Miseler','OC6kYMIS',20011112154757);
+INSERT INTO users VALUES (127,'falen@freenet.de',NULL,'Hattingerstr.241','44795 Bochum',77,'','Torsten','Felske','CqrtmkIt',20011112165628);
+INSERT INTO users VALUES (128,'jb559755@rcs.urz.tu-dresden.de',NULL,'Gubener Str. 36','01237 Dresden',77,'0172/3515486','Jens','Bergmann','UINiqkC1',20011112172156);
+INSERT INTO users VALUES (129,'St.Ziegler@gmx.de',NULL,'Hirschgraben 24','Aachen',77,'','Stefan','Ziegler','nxQSXfF6',20011112184027);
+INSERT INTO users VALUES (130,'tach.uli@t-online.de',NULL,'Limbeckstr.1b','44894 Bochum',77,'0234/261526','Ulrich','Meise','pPFz3COy',20011112204010);
+INSERT INTO users VALUES (131,'cyrion_@web.de',NULL,'Bachstr. 81','28199 Bremen',77,'','Christian','Büthe','vwmvxxrH',20011112225303);
+INSERT INTO users VALUES (132,'torsten@steigner.de',NULL,'Alleestraße 4','66882 Huetschenhausen',77,'','Torsten','Steigner','eZxwKddw',20011113005654);
+INSERT INTO users VALUES (133,'esclarmunde@gmx.de',NULL,'Kastanienstr.13','24114 Kiel',77,'0431/6794667','Jörn','Gräbert','meXNQnPx',20011113013016);
+INSERT INTO users VALUES (134,'harryrat@gmx.de',NULL,'Kastanienweg 13','52074 Aachen',77,'0241-81806','Harald','Radke','Pbzjwagv',20011113085313);
+INSERT INTO users VALUES (135,'stefan@hoeffling.de',NULL,'Franziskanerstr. 1','56154 Boppard',77,'06742/82512','Stefan','Hoeffling','HLtorF5o',20011113145256);
+INSERT INTO users VALUES (136,'esclarmunde@gmx.de',NULL,'Kastanienstr.13','24114 Kiel',77,'0431/6794667','Jörn','Gräbert','0HmvpMSi',20011113151218);
+INSERT INTO users VALUES (137,'Frank.Adler@gmx.net',NULL,'Gertrudisweg 5','Euskirchen',77,'','Frank','Adler','6fWjD6Ib',20011113230300);
+INSERT INTO users VALUES (138,'jens.otte@gmxpro.de',NULL,'Am Suedhang 5','Glinde',77,'+494075665561','Jens','Otte','m7omFMzP',20011114002043);
+INSERT INTO users VALUES (139,'martin@hershoff.de',NULL,'Abtsbrede 47','33098 Paderborn',77,'','Martin','Hershoff','UTJXiCMw',20011114110237);
+INSERT INTO users VALUES (140,'n.werhahn@t-online.de',NULL,'kohlenweg 10','Baden Baden',76534,'01796972416','nils','werhahn','ZfBmZlMe',20011114111939);
+INSERT INTO users VALUES (141,'elvis@eressea-pbem.de',NULL,'Rockaway','Memphis',77,'','Elvis','The King','Z7VXtjiX',20011114162334);
+INSERT INTO users VALUES (142,'zdomotor@axelero.hu',NULL,'Liszt Ferenc 3','H-2045 Törökbálint',93,'0036 23 336 385','Zoltán','Dömötör','p57pnZGf',20011116221701);
+INSERT INTO users VALUES (143,'faber@kawo1.rwth-aachen.de',NULL,'Kastanienweg 4 / 2225','52074 Aachen',77,'0241/9810789','Michael','Ziegler','aDP4eoC0',20011118204013);
+
diff --git a/scripts/register/wait-reset.py b/scripts/register/wait-reset.py
new file mode 100755
index 000000000..ebef9a734
--- /dev/null
+++ b/scripts/register/wait-reset.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+#
+# reset the waiting list after ZAT.
+# before running this script, be sure to apply the patchfile generated by the eressea-server to
+# mark users with new accounts as ACTIVE.
+# * Will mark WAITING users as EXPIRED, removig them from the waitng list.
+# * Will mark CONFIRMED users as WAITING, and send them another mail.
+
+import MySQLdb
+import string
+import re
+import sys
+import os
+import smtplib
+
+dbname=sys.argv[1]
+date=sys.argv[2]
+From='accounts@eressea-pbem.de'
+smtpserver='localhost'
+server=smtplib.SMTP(smtpserver)
+patchdir='/home/eressea/eressea-rsync'
+game_id=0
+
+db=MySQLdb.connect(db=dbname)
+cursor=db.cursor()
+cursor.execute("select name, patch from games where id="+str(game_id))
+game, patch = cursor.fetchone()
+
+MailTemplate="templates/register.mail."+string.lower(game)
+
+def Patch():
+ global patch
+
+ print "Auswertung für " + game + " Patch Level " + str(int(patch))
+ while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
+ patch=patch+1
+ print " Patching to level "+str(patch)
+ os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
+ cursor.execute('update games set patch='+str(int(patch))+' where id='+str(game_id))
+ return
+
+def Send(email, custid, firstname, password, position, locale):
+ TemplateHandle = open(MailTemplate+"."+locale, "r") # open in read only mode
+ # read the entire file as a string
+ TemplateInput = TemplateHandle.read()
+ TemplateHandle.close() # close the file
+
+ SubResult = re.subn("", firstname, TemplateInput)
+ SubResult = re.subn("", game, SubResult[0])
+ SubResult = re.subn("", password, SubResult[0])
+ SubResult = re.subn("", str(int(position)), SubResult[0])
+ SubResult = re.subn("", str(int(custid)), SubResult[0])
+
+ Msg="From: "+From+"\nTo: "+email+"\nSubject: Eressea Anmeldung\n\n"
+ Msg=Msg+SubResult[0]
+ server.sendmail(From, email, Msg)
+ return
+
+Patch()
+# remove all illegal and banned users:
+users = cursor.execute("SELECT s.id from users u, subscriptions s where u.id=s.user and u.status in ('BANNED', 'ILLEGAL')")
+update=db.cursor()
+while users:
+ users=users-1
+ sid = cursor.fetchone()[0]
+ update.execute("UPDATE subscriptions set status='EXPIRED' WHERE id="+str(int(sid)))
+
+# espire all users without confirmation. reset waiting list.
+cursor.execute("update subscriptions set status='EXPIRED' where TO_DAYS(updated)2:
+ dryrun=1
+price=1.25
+warnahead=4
+cancelafter=1
+db=MySQLdb.connect(db=dbname)
+cursor=db.cursor()
+server=smtplib.SMTP('localhost')
+print "connected to SMTP"
+users = cursor.execute("select users.email, users.id, count(subscriptions.game) from users, subscriptions, games where users.id=subscriptions.user and subscriptions.game=games.id and users.id!=0 and games.status='RUNNING' GROUP BY users.id")
+while users > 0:
+ users=users-1
+ email, uid, games = cursor.fetchone()
+ if games==0:
+ continue
+ c2 = db.cursor()
+ t = c2.execute("select sum(balance) from transactions where user="+str(int(uid)))
+ if t==0:
+ balance=0.0
+ else:
+ balance = c2.fetchone()[0]
+ Msg=None
+ if balance <= games*warnahead*price:
+ Msg = ("From: Vinyambar Buchhaltung <"+From+">\nTo: "+email+"\n")
+ if balance < -games*cancelafter*price:
+ Msg=Msg+"Subject: Vinyambar Abmeldung Kunde "+str(int(uid))+".\n\n"
+ Msg = Msg+("Nachdem Dein Konto bei uns im Minus ist, haben wir deine\n"+
+ "Anmeldung bei Vinyambar gekündigt, und die Partei(en) der Parteibörse\n"+
+ "zugeführt.\n")
+ print "CANCEL: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
+ if dryrun==0:
+ c2.execute("UPDATE subscriptions set status='CANCELLED' where user="+str(int(uid)))
+ else:
+ print "WARNING: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
+ Msg = Msg+"Subject: WARNUNG - Vinyambar Kontostand Kunde "+str(int(uid))+"\n\n"
+ Msg = Msg+("Dein Vinyambar Kontostand reicht nicht mehr aus, um die kommenden "+str(warnahead)+"\n"+
+ "Wochen zu bezahlen. Bitte mache baldmöglichst eine neue Überweisung\n"
+ "auf das Vinyambar-Konto.\n\n"+
+ "Kundennummer: "+str(uid)+"\n"+
+ "Kontostand: "+str(balance)+" EUR\n"+
+ "\n"+
+ "Unser Konto: Katja Zedel\n"+
+ "Kontonummer 1251 886 106\n"+
+ "BLZ 500 502 01 (Frankfurter Sparkasse)\n")
+
+ if (Msg!=None) and dryrun==0:
+ try:
+ server.sendmail(From, email, Msg)
+ except:
+ print "Could not send confirmation to "+email
+ print "Exception is:", sys.exc_type, ":", sys.exc_value
+
diff --git a/scripts/register/zat.py b/scripts/register/zat.py
new file mode 100755
index 000000000..0b38b1c24
--- /dev/null
+++ b/scripts/register/zat.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+import MySQLdb
+import sys
+import os
+
+dbname=sys.argv[1]
+gid=int(sys.argv[2])
+date=sys.argv[3]
+price=1.25
+db=MySQLdb.connect(db=dbname)
+patchdir='/home/eressea/vinyambar-rsync/vin'+str(gid)+'/data'
+
+cursor=db.cursor()
+
+def SetUser(cursor, num, newuser):
+ update = db.cursor()
+ while num:
+ num = num-1
+ uid, faction = cursor.fetchone()
+ update.execute("insert into transfers (faction, game, src,dst) values ('"+faction+"', "+str(gid)+", "+str(int(uid))+", 0)")
+ update.execute("update subscriptions set user="+str(newuser)+" where game="+str(gid)+" and faction='"+faction+"'")
+
+
+k = cursor.execute('select name, patch from games where id='+str(gid))
+if k==0:
+ print "Unbekanntes Spiel"
+
+name, patch = cursor.fetchone()
+
+os.system("mysqldump vinyambar > backup-vinyambar-"+str(int(patch))+".sql")
+
+k = cursor.execute("SELECT max(lastturn) from subscriptions")
+lastturn = int(cursor.fetchone()[0])
+
+print "Auswertung für " + name + " Patch Level " + str(int(patch)) + ", Runde "+str(lastturn)
+while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
+ patch=patch+1
+ print " Patching to level "+str(patch)
+ os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
+ cursor.execute('update games set patch='+str(int(patch))+' where id='+str(gid))
+
+k = cursor.execute("select user, faction from subscriptions where game="+str(gid)+" and status='TRANSFERED' and user!=0 and updated<'"+date+"'")
+print "Removing "+str(int(k))+" transfered subscriptions."
+SetUser(cursor, int(k), 0)
+
+k = cursor.execute("select user, faction from subscriptions where game="+str(gid)+" and status='CANCELLED' and user!=0 and updated<'"+date+"'")
+print "Removing "+str(int(k))+" cancelled subscriptions."
+SetUser(cursor, int(k), 0)
+
+k = cursor.execute("select user, faction from subscriptions where game="+str(gid)+" and user!=0 and status='DEAD'")
+print "Removing "+str(int(k))+" dead subscriptions."
+
+k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where game="+str(gid)+" and status='ACTIVE' and lastturn+3<="+str(lastturn))
+if k:
+ print "Cancelling subscriptions with 3+ NMRs."
+
+cursor.execute("SELECT count(*) from transactions where date='"+date+"' and description='ZAT-"+str(gid)+"'")
+k = cursor.fetchone()[0]
+if k==0:
+ k = cursor.execute("SELECT users.id FROM users, subscriptions WHERE users.id=subscriptions.user and subscriptions.status='ACTIVE' and subscriptions.game="+str(gid))
+ print "Billing "+str(int(k))+" users."
+ while k!=0:
+ k=k-1
+ user = int(cursor.fetchone()[0])
+ update=db.cursor()
+ update.execute("INSERT INTO transactions (user,date,balance,description) VALUES ("+str(user)+", '"+date+"', -"+str(price)+", 'ZAT-"+str(gid)+"')")
+else:
+ print "ERROR: ZAT for game "+str(gid)+" has already been done."
diff --git a/scripts/templates/eressea.html b/scripts/templates/eressea.html
new file mode 100644
index 000000000..7dd87d963
--- /dev/null
+++ b/scripts/templates/eressea.html
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+Eressea PBEM
+
+
+
+
+
+
+
+
diff --git a/scripts/templates/register.mail.eressea.de b/scripts/templates/register.mail.eressea.de
new file mode 100644
index 000000000..ab9c4e1d3
--- /dev/null
+++ b/scripts/templates/register.mail.eressea.de
@@ -0,0 +1,22 @@
+Hallo ,
+
+Du stehst mit deiner Anmeldung bei auf der Warteliste für neue Parteien
+derzeit an Position . Um Deine Anmeldung zu bestätigen, gehe bitte
+auf die folgende Webseite, und gib dort zur Bestätigung deine Kundennummer
+und den Bestätigungsschlüssel ein.
+
+ http://eressea-pbem.de/de/confirm.html
+ Kundennummer:
+ Schlüssel:
+
+Um sicherzustellen, das nur interessierte Spieler in der Warteliste sind,
+muß diese Prozedur einmal wöchentlich wiederholt werden. Du bekommst daher
+wöchentlich eine Erinnerungsmail, in der Du auch deine aktuelle Position in
+der Warteliste sehen kannst.
+
+Solltest Du den Schlüssel bis Sonntag früh nicht eingegeben haben, wird
+deine Anmeldung aus der Warteliste entfernt, und Du bekommst keine weiteren
+Mails von uns.
+
+
+Das Eressea-Team
diff --git a/scripts/templates/register.mail.eressea.en b/scripts/templates/register.mail.eressea.en
new file mode 100644
index 000000000..41759f740
--- /dev/null
+++ b/scripts/templates/register.mail.eressea.en
@@ -0,0 +1,20 @@
+Hello ,
+
+You are now entered into the waiting list of , at position .
+To confirm your subscription, please go to the following URL and enter your
+Customer-ID and confirmation key.
+
+ http://eressea-pbem.de/en/confirm.html
+ Customer ID:
+ Key:
+
+To make sure that only those players interested in playing remain on the
+list, you need to repeat this procedure once every week. We will send you this
+reminder by mail, in which you'll also see your updated position on the
+waiting list.
+
+If you do not enter the key before sunday morning 9:00 CET, your
+registration will be considered cancelled, and you will receive no further
+email from us.
+
+The Eressea Team
diff --git a/scripts/templates/register.mail.tutorial.de b/scripts/templates/register.mail.tutorial.de
new file mode 100644
index 000000000..963d7c76b
--- /dev/null
+++ b/scripts/templates/register.mail.tutorial.de
@@ -0,0 +1,21 @@
+Hallo ,
+
+Als bisher nicht registrierter Eressea-Spieler haben wir Dich zu einer 5
+Runden dauernden Schnupperpartie eingetragen. Dieses Tutorial gibt Dir die
+Chance, deine Anfangsstrategie auszuprobieren und festzustellen, ob Du die
+Regeln auch wirklich verstanden hast.
+
+Nachdem Du 5 Runden im Tutorial gespielt hast, werden wir deinen Account für
+das richtige Eressea-Spiel freischalten. Das hat für alle Beteiligten auch
+den Vorteil, das nur solche Spieler teilnehmen, die über Grundkenntnisse der
+Regeln verfügen, und wissen, worum es bei Eressea geht.
+
+Um Deine Anmeldung zu bestätigen, gehe bitte auf die folgende Webseite, und
+gib dort zur Bestätigung deine Kundennummer und den Bestätigungsschlüssel
+ein.
+
+ http://eressea-pbem.de/de/confirm.html
+ Kundennummer:
+ Schlüssel:
+
+Das Eressea-Team
diff --git a/scripts/templates/register.mail.tutorial.en b/scripts/templates/register.mail.tutorial.en
new file mode 100644
index 000000000..4e6f84b98
--- /dev/null
+++ b/scripts/templates/register.mail.tutorial.en
@@ -0,0 +1,19 @@
+Hello ,
+
+as a new player, you have been entered into the Eressea tutorial game. By
+letting you play the tutorial first, we're giving you the chance to test
+your knowledge of the rules and exxperiment for a few turns befor the actual
+game starts - consider this a way to test your initial strategy. Better to
+make mistakes now than later, right?
+
+Once you finish 5 turns in this game (which will have a turn every 2 days),
+your Account will be upgraded, allowing you to subscribe to Eressea.
+
+To confirm this subscription, please go to the following URL and enter your
+new Customer-ID and confirmation key.
+
+ http://eressea-pbem.de/en/confirm.html
+ Customer ID:
+ Key:
+
+The Eressea Team
diff --git a/scripts/templates/vinyambar-register.mail.de b/scripts/templates/vinyambar-register.mail.de
new file mode 100644
index 000000000..193947501
--- /dev/null
+++ b/scripts/templates/vinyambar-register.mail.de
@@ -0,0 +1,22 @@
+Hallo ,
+
+Deine Vinyambar-Anmeldung ist beinahe komplett. Um Deine Anmeldung zu bestätigen,
+gehe bitte auf die folgende Webseite, und gib dort zur Bestätigung deine
+Kundennummer und das Kundenpasswort ein.
+
+ http://www.vinyambar.de/accounts.shtml
+ Kundennummer:
+ Kundenpasswort:
+
+Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das
+Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner
+Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.
+
+Die Kundennummer gib bitte bei der Überweisung der Spielgebühren an.
+Unsere Kontoinformationen lauten:
+
+ Katja Zedel
+ Kontonummer 1251 886 106
+ BLZ 500 502 01 (Frankfurter Sparkasse)
+
+Das Vinyambar-Team
diff --git a/scripts/templates/vinyambar-register.mail.en b/scripts/templates/vinyambar-register.mail.en
new file mode 100644
index 000000000..193947501
--- /dev/null
+++ b/scripts/templates/vinyambar-register.mail.en
@@ -0,0 +1,22 @@
+Hallo ,
+
+Deine Vinyambar-Anmeldung ist beinahe komplett. Um Deine Anmeldung zu bestätigen,
+gehe bitte auf die folgende Webseite, und gib dort zur Bestätigung deine
+Kundennummer und das Kundenpasswort ein.
+
+ http://www.vinyambar.de/accounts.shtml
+ Kundennummer:
+ Kundenpasswort:
+
+Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das
+Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner
+Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.
+
+Die Kundennummer gib bitte bei der Überweisung der Spielgebühren an.
+Unsere Kontoinformationen lauten:
+
+ Katja Zedel
+ Kontonummer 1251 886 106
+ BLZ 500 502 01 (Frankfurter Sparkasse)
+
+Das Vinyambar-Team
diff --git a/scripts/templates/vinyambar.html b/scripts/templates/vinyambar.html
new file mode 100644
index 000000000..82c709c2a
--- /dev/null
+++ b/scripts/templates/vinyambar.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+Vinyambar PBEM
+
+
+
+
+
+