forked from github/server
updates to transfers
This commit is contained in:
parent
5137c0bc6a
commit
bb3b1bd8bb
|
@ -14,6 +14,7 @@ From = "accounts@vinyambar.de"
|
||||||
Errors = ""
|
Errors = ""
|
||||||
db = MySQLdb.connect(db=dbname)
|
db = MySQLdb.connect(db=dbname)
|
||||||
smtpserver='localhost'
|
smtpserver='localhost'
|
||||||
|
notify='accounts@vinyambar.de'
|
||||||
|
|
||||||
# define a new function called Display
|
# define a new function called Display
|
||||||
# it takes one parameter - a string to Display
|
# it takes one parameter - a string to Display
|
||||||
|
@ -55,6 +56,7 @@ def ShowPage():
|
||||||
while results>0:
|
while results>0:
|
||||||
results=results-1
|
results=results-1
|
||||||
gid, game, faction, lastturn, sid, race, info = cursor.fetchone()
|
gid, game, faction, lastturn, sid, race, info = cursor.fetchone()
|
||||||
|
if lastturn<maxturn[gid]:
|
||||||
if info==None:
|
if info==None:
|
||||||
info='Keine Informationen'
|
info='Keine Informationen'
|
||||||
output=output+'<tr><td>'+ race + '</td><td>'+ game + '</td><td>' + str(int(maxturn[gid]-lastturn)) + '</td><td>' + info + '</td>'
|
output=output+'<tr><td>'+ race + '</td><td>'+ game + '</td><td>' + str(int(maxturn[gid]-lastturn)) + '</td><td>' + info + '</td>'
|
||||||
|
@ -84,8 +86,8 @@ if Form.has_key("pass"):
|
||||||
if (password!=None) & (custid!=None):
|
if (password!=None) & (custid!=None):
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
output=""
|
output=""
|
||||||
if cursor.execute("select email, id from users where password='"+password+"' and id="+str(int(custid)))==1:
|
if cursor.execute("select firstname, lastname, email, id from users where password='"+password+"' and id="+str(int(custid)))==1:
|
||||||
email, custid = cursor.fetchone()
|
firstname, lastname, email, custid = cursor.fetchone()
|
||||||
c = cursor.execute("SELECT id, game, password, faction from subscriptions where status='CANCELLED'")
|
c = cursor.execute("SELECT id, game, password, faction from subscriptions where status='CANCELLED'")
|
||||||
while c>0:
|
while c>0:
|
||||||
c=c-1
|
c=c-1
|
||||||
|
@ -94,15 +96,23 @@ if (password!=None) & (custid!=None):
|
||||||
update = db.cursor()
|
update = db.cursor()
|
||||||
update.execute("UPDATE subscriptions set user=" + str(int(custid)) + ", status='ACTIVE' where id=" + str(int(sid)))
|
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>"
|
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="From: "+From+"\nTo: "+email+"\nSubject: Vinambar Parteiuebernahme\n\n"
|
||||||
Msg=Msg+"Das Passwort für deine neue Vinyambar-Partei "+faction+" lautet\n"
|
Msg=Msg+"Das Passwort für deine neue Vinyambar-Partei "+faction+" lautet\n"
|
||||||
Msg=Msg+" "+newpass+"\n"
|
Msg=Msg+" "+newpass+"\n"
|
||||||
Msg=Msg+"\nUm den Report der letzten Woche zu erhalten, schicke eine Mail mit dem Betreff\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+"VIN"+str(int(gid))+" REPORT "+faction+" \""+newpass+"\" an die Adresse "
|
||||||
Msg=Msg+"vinyambar@eressea.amber.kn-bremen.de"
|
Msg=Msg+"vinyambar@eressea.amber.kn-bremen.de"
|
||||||
|
|
||||||
server=smtplib.SMTP(smtpserver)
|
|
||||||
server.sendmail(From, email, Msg)
|
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()
|
server.close()
|
||||||
else:
|
else:
|
||||||
output="<font color=red>Fehler in Passwort oder Kundennummer<br></font>"
|
output="<font color=red>Fehler in Passwort oder Kundennummer<br></font>"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -37,7 +37,7 @@ while users > 0:
|
||||||
"zugeführt.\n")
|
"zugeführt.\n")
|
||||||
print "CANCEL: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
|
print "CANCEL: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
|
||||||
if dryrun==0:
|
if dryrun==0:
|
||||||
c2.execute("UPDATE subscriptions set user=0, status='CANCELLED' where user="+str(int(uid)))
|
c2.execute("UPDATE subscriptions set status='CANCELLED' where user="+str(int(uid)))
|
||||||
else:
|
else:
|
||||||
print "WARNING: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
|
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+"Subject: WARNUNG - Vinyambar Kontostand Kunde "+str(int(uid))+"\n\n"
|
||||||
|
|
|
@ -30,17 +30,21 @@ while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
|
||||||
os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
|
os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
|
||||||
cursor.execute('update games set patch='+str(int(patch))+' where id='+str(game))
|
cursor.execute('update games set patch='+str(int(patch))+' where id='+str(game))
|
||||||
|
|
||||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='TRANSFERED' and updated<'"+date+"'")
|
k = cursor.execute("UPDATE subscriptions SET user=0, status='CANCELLED' where game="+str(int(game))+" and status='TRANSFERED' and updated<'"+date+"'")
|
||||||
print "Removing "+str(int(k))+" transfered subscriptions."
|
if k:
|
||||||
|
print "Removing untransfered subscriptions."
|
||||||
|
|
||||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='CANCELLED' and updated<'"+date+"'")
|
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='CANCELLED' and updated<'"+date+"'")
|
||||||
print "Removing "+str(int(k))+" cancelled subscriptions."
|
if k:
|
||||||
|
print "Removing cancelled subscriptions."
|
||||||
|
|
||||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='DEAD'")
|
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='DEAD'")
|
||||||
print "Removing "+str(int(k))+" dead subscriptions."
|
if k:
|
||||||
|
print "Removing dead subscriptions."
|
||||||
|
|
||||||
k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where game="+str(int(game))+" and status='ACTIVE' and lastturn+3<="+str(lastturn))
|
k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where game="+str(int(game))+" and status='ACTIVE' and lastturn+3<="+str(lastturn))
|
||||||
print "Cancelling "+str(int(k))+" active subscriptions with 3+ NMRs."
|
if k:
|
||||||
|
print "Cancelling subscriptions with 3+ NMRs."
|
||||||
|
|
||||||
k = cursor.execute("SELECT users.id FROM users, subscriptions WHERE users.id=subscriptions.user and subscriptions.status='ACTIVE' and subscriptions.game="+str(game))
|
k = cursor.execute("SELECT users.id FROM users, subscriptions WHERE users.id=subscriptions.user and subscriptions.status='ACTIVE' and subscriptions.game="+str(game))
|
||||||
while k!=0:
|
while k!=0:
|
||||||
|
|
Loading…
Reference in New Issue