removing and moving to make a clean eressea-only repo

This commit is contained in:
Enno Rehling 2010-03-06 14:32:20 -08:00
parent 60920d20bd
commit dd3f204a69
195 changed files with 0 additions and 135217 deletions

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,95 +0,0 @@
#!/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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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="<p>Um Deine Anmeldung zu bestätigen musst Du das Formular vollständig ausfüllen.\n "
for key in Form.keys():
output=output+"<br>"+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('<p>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("<p>Deine Anmeldung wurde bestätigt.");
db.close()

View File

@ -1,209 +0,0 @@
#!/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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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>", firstname, TemplateInput)
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
SubResult = re.subn("<GAME>", name, SubResult[0])
SubResult = re.subn("<CUSTID>", 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="<p>Um Dich zu Eressea anzumelden musst Du das Formular vollständig ausfüllen.\n "
for key in Form.keys():
output=output+"<br>"+key+": "+Form[key].value+"\n"
Display(output)
elif ValidEmail(email)==0:
output="<p>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('<p>'+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('<em>Dein Account ist gesperrt.</em><br>Bitte wende Dich an <a href="mailto:accounts@eressea-pbem.de">accounts@eressea-pbem.de</a> 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("<p>"+text[locale]+".")
db.close()

View File

@ -1,319 +0,0 @@
#!/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+"<br>"+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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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('<div align="center">Das Passwort wurde verschickt</div>', 'Kundendaten #'+str(custid))
except:
Display('<div align="center">Beim Versenden des Passwortes ist ein Fehler aufgetreten.<br>Eventuell ist die email-Adresse unbekannt</div>', '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 = '<div align=center>Letzter Buchungstag: '+str(lastdate)[0:10]+'</div><form action="'+scripturl+'" method=post><div align=center><table bgcolor="#e0e0e0" width=80% border>\n'
query = "SELECT sum(balance) from transactions where user="+str(custid)
transactions = cursor.execute(query)
balance = 0.00
if transactions != 0:
balance = cursor.fetchone()[0]
if balance == None:
balance=0.00
line = "<font color=red>"+Errors+"</font><tr>"
line = line + "<tr><th height=30>Vorname</th><td><input size=40 name=firstname value=\""+firstname+"\"></td></tr>\n"
line = line + "<tr><th height=30>Nachname</th><td><input size=40 name=lastname value=\""+lastname+"\"></td></tr>\n"
if email==None:
email=""
line = line + "<tr><th height=30>EMail Adresse</th><td><input size=40 name=email value=\""+email+"\"></td></tr>\n"
if address==None:
address=""
line = line + "<tr><th height=30>Adresse</th><td><input size=40 name=address value=\""+address+"\"></td></tr>\n"
if city==None:
city=""
line = line + "<tr><th height=30>Wohnort</th><td><input size=40 name=city value=\""+city+"\"></td></tr>\n"
if phone==None:
phone=""
line = line + "<tr><th height=30>Telefon</th><td><input size=40 name=phone value=\""+phone+"\"></td></tr>\n"
line = line + "<tr><th height=30>Kontostand</th><td>"+str(balance)+" EUR</td></tr>\n"
line = line + "<tr><th height=30>Status</th><td>"+status+"</td></tr>\n"
output = output + line;
output=output+"</table></div>"
output=output+"<div align=center><h3>Partien</h3>\n"
games = cursor.execute("select id, name, status, info from games order by id")
while games>0:
games=games-1
gid, game, status, info = cursor.fetchone()
cself = db.cursor();
sub = cself.execute("select s.race from subscriptions s, users u where game="+str(int(gid))+" and u.id=s.user and u.id="+str(int(custid)))
prev=""
if sub>0:
prev=cself.fetchone()[0]
if prev==None:
prev=""
line = '<table bgcolor="#e0e0e0" width=80% border>\n<tr><th align=center><em>' + game + '</em>: ' + info + '</th></tr>'
if status=='WAITING':
line = line+'<tr><td>'
line = line + 'Ich möchte an diesem Spiel teilnehmen, und bevorzuge folgende Rasse:<br>\n'
nraces=len(races)
line = line + '<select name="race_'+str(int(gid))+'" size="1">'
while nraces>0:
nraces=nraces-1
race=races[nraces]
if prev == race[0]:
line = line + '<OPTION selected value="'+race[0]+'">'+race[1]+'\n'
else:
line = line + '<OPTION value="'+race[0]+'">'+race[1]+'\n'
line = line + '</select>'
line = line+'</td></tr>'
elif status=='RUNNING':
query = ("select games.name, races.name, s.status, s.faction "+
"from races, games, subscriptions s "+
"where s.race=races.race and s.game="+str(int(gid))+" and s.game=games.id "+
"and s.user="+str(custid)+" ")
fcursor = db.cursor()
results = fcursor.execute(query)
if results>0:
while results>0:
results = results - 1
game, race, status, faction = fcursor.fetchone()
line = line + '<tr><td><em>Partei ' + faction + ', ' + race + ", " + status + "</em></td></tr>"
line = line + "<tr><td>"
if status=='ACTIVE':
line = line + 'Ich möchte diese Partei aufgeben: <input type="checkbox" name="cancel_' + faction + '"><br>\n'
line = line + 'Ich möchte die Partei an Spieler #<input size=4 name="transfer_' + faction + '"> übergeben.\n'
elif status=='CANCELLED':
line = line + 'Reaktivieren: <input type="checkbox" name="activate_' + faction + '">\n'
elif status=='TRANSFERED':
line = line + 'Transfer akzeptieren: <input type="checkbox" name="accept_' + faction + '">\n'
line = line+'</td></tr>'
else:
continue
else:
continue
output=output+line+'</table>\n<p>\n'
output=output+"</div>"
query="select date, balance, text from transactions, descriptions where descriptions.handle=transactions.description and user="+str(custid)+" ORDER BY date"
results = cursor.execute(query);
if results>0:
output=output+'<div align=center>\n<h3>Transaktionen</h3>\n<table width=80% bgcolor="#e0e0e0" border>\n'
output=output+"<tr><th>Datum</th><th>Betrag</th><th>Verwendung</th></tr>\n"
while results>0:
results = results - 1
row = cursor.fetchone()
line = "<tr>"
line = line + "<td align=left>"+str(row[0])[0:10]+"</td>\n"
line = line + "<td align=right>"+str(row[1])+" EUR</td>\n"
line = line + "<td align=left>"+row[2]+"</td>\n"
line = line + "</tr>\n"
output=output+line
output=output+"</table></div>"
output=output+'<div align=center><p><input name="save" type="submit" value="Speichern"></div>'
output=output+'<input type="hidden" name="user" value="'+str(custid)+'"></div>'
output=output+'<input type="hidden" name="pass" value="'+Password+'"></div>'
output=output+"</form>"
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+"<br>\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)

View File

@ -1,213 +0,0 @@
#!/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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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<p><a href="'+myurl+'">Ergebnisse ansehen</a>\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 = "<h2>Kommentare</h2>\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+"<p>"+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="<h2>Spielerprofil</h2>\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)+")<br>\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 ="<h2>Spielspaß</h2>\n<table>\n"
for key in funtypes.keys():
cursor.execute("SELECT COUNT(*) FROM poll WHERE fun='"+key+"'")
value = int(cursor.fetchone()[0])
funtext=funtext+"<tr><td>"+funtypes[key]+"</td><td>"+str(value)+"</td></tr>\n"
funtext=funtext+"</table>\n"
playertypes = { 'killer': 'Strategiespiel', 'explorer':'Erkundung', 'achiever':'Aufbau und Entwicklung', 'socializer':'Rollenspiel' }
typetext ="<h2>Spielaspekte</h2>\n<table>\n"
for key in playertypes.keys():
cursor.execute("SELECT AVG("+key+") FROM poll")
value = cursor.fetchone()[0]
typetext=typetext+"<tr><td>"+playertypes[key]+"</td><td>"+str(value)+"</td></tr>\n"
typetext=typetext+"</table>\n"
toolnames=('magellan', 'crtools','ehmv', 'echeck', 'mercator', 'emap', 'esurvey', 'vorlage', 'othertools')
tooltext="<h2>Tools</h2>\n<table>\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+"<tr><td>"+tool+'</td><td>'+str(num)+' ('+str(int(num*100.0/answers))+'%)</td></tr>\n'
tooltext=tooltext+"</table><h3>...andere</h3>\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+"<br>\n"
referernames= {'friends':'Freunde &amp; Familie','pbemdirect':'PBEM Webseiten','other':'Andere', 'otherpbem':'Andere PBEM', 'searchengi':'Suchmaschinen','press':'Presse','yahoo':'Yahoo &amp; Co,' }
referertext="<h2>Wie bist Du zu Eressea gekommen?</h2>\n<table>\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+"<tr><td>"+referernames[referer]+'</td><td>'+str(num)+"</td></tr>\n"
referertext=referertext+"</table><h3>...andere</h3>\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+"<br>\n"
scenarionames={'fast':'Zweimal pro Woche','slow':'Alle zwei Wochen','madmax':'Endzeit-Eressea'}
scenariotext="<h2>Kommerzielle Szenarios</h2>\n<table>\n"
for scenario in scenarionames.keys():
results=cursor.execute('SELECT count(*) from poll where '+scenario+'=1')
if results==1:
scenariotext=scenariotext+"<tr><td>"+scenarionames[scenario]+'</td><td>'+str(int(cursor.fetchone()[0]))+'</td>\n'
scenariotext=scenariotext+"</table>\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 = "<h2>Heimatländer</h2>\n<table>"
for country in countries.keys():
# countryfile.write(country + '\t' + str(countries[country]) + '\n')
countrytext=countrytext+"<tr><td>"+country + '</td><td>' + str(countries[country]) + '</td></tr>\n'
countrytext=countrytext+"</table>\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 | |
#+--------------+-------------+------+-----+---------+-------+

View File

@ -1,22 +0,0 @@
Hallo <FIRSTNAME>,
Du stehst mit deiner Anmeldung bei Eressea auf der Warteliste für neue Parteien
derzeit an Position <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: <CUSTID>
Schlüssel: <PASSWORD>
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

View File

@ -1,20 +0,0 @@
Hello <FIRSTNAME>,
You are now entered into the waiting list of Eressea, at position <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: <CUSTID>
Key: <PASSWORD>
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

View File

@ -1,125 +0,0 @@
#!/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+"<br>"+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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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='<p>Um eine der folgenden Parteien zu übernehmen, musst du zuerst ein <a href="register.php">Spielerkonto anlegen</a>. 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+'<div align=center><form action="'+scripturl+'" method=post><table bgcolor="#e0e0e0" width="80%" border>\n'
output=output+'<tr><th>Rasse</th><th>Spiel</th><th>NMRs</th><th>Informationen</th><th>Markieren</th></tr>'
while results>0:
results=results-1
gid, game, faction, lastturn, sid, race, info = cursor.fetchone()
if lastturn<=maxturn[gid]+minnmr:
if info==None:
info='Keine Informationen'
output=output+'<tr><td>'+ race + '</td><td>'+ game + '</td><td>' + str(int(maxturn[gid]-lastturn)) + '</td><td>' + info + '</td>'
output=output+'<td><input type="checkbox" name="accept_' + str(int(sid)) + '"> übernehmen</td></tr>\n'
output=output+'</table>'
output=output+'<p><table><tr><td>Kundennummer:</td><td><input name="user" size="4"></tr><tr><td>Passwort:</td><td><input name="pass" type="password" size="40"></td>'
output=output+'<tr><td>'
output=output+'<input name="save" type="submit" value="Abschicken">'
output=output+'</td></tr></table>'
# output=output+'<p>Aus technischen Gründen wird diese Seite erst am Dienstag abend wieder benutzbar sein.'
output=output+'</form></div>'
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.<br>"
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="<font color=red>Fehler in Passwort oder Kundennummer<br></font>"
Display(output)
else:
ShowPage()
db.close()

View File

@ -1,132 +0,0 @@
#!/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("<!-- INSERT TITLE HERE -->", Title, TemplateInput)
SubResult = re.subn("<!-- INSERT CONTENT HERE -->", 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>", firstname, TemplateInput)
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
SubResult = re.subn("<CUSTID>", 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="<p>Um Dich zu Vinyambar anzumelden musst Du das Formular vollständig ausfüllen.\n "
for key in Form.keys():
output=output+"<br>"+key+": "+Form[key].value+"\n"
Display(output)
elif ValidEmail(email)==0:
output="<p>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('<p>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("<p>"+text[locale]+".")
db.close()

View File

@ -1,24 +0,0 @@
#!/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

View File

@ -1,42 +0,0 @@
#!/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

View File

@ -1,4 +0,0 @@
#!/bin/sh
# notify the web user of the change
mailx -s "update eressea" www-data@eressea.upb.de

View File

@ -1,12 +0,0 @@
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

View File

@ -1,30 +0,0 @@
#!/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();

View File

@ -1,36 +0,0 @@
** 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

View File

@ -1,51 +0,0 @@
#!/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"

View File

@ -1,19 +0,0 @@
#!/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

View File

@ -1,18 +0,0 @@
#!/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

View File

@ -1,54 +0,0 @@
#!/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>', custid, line)
line = re.sub('<FIRSTNAME>', firstname, line)
line = re.sub("<GAMENAME>", 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()

View File

@ -1,56 +0,0 @@
#!/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()

View File

@ -1,351 +0,0 @@
# 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</SELECT>');
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;

View File

@ -1,30 +0,0 @@
#!/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"

View File

@ -1,51 +0,0 @@
#!/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()

View File

@ -1,35 +0,0 @@
#!/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

View File

@ -1,34 +0,0 @@
#!/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')

View File

@ -1,53 +0,0 @@
#!/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>', custid, line)
line = re.sub('<FIRSTNAME>', firstname, line)
# line = re.sub("<GAMENAME>", 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()

Some files were not shown because too many files have changed in this diff Show More