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 = ""
|
||||
db = MySQLdb.connect(db=dbname)
|
||||
smtpserver='localhost'
|
||||
notify='accounts@vinyambar.de'
|
||||
|
||||
# define a new function called Display
|
||||
# it takes one parameter - a string to Display
|
||||
|
@ -55,10 +56,11 @@ def ShowPage():
|
|||
while results>0:
|
||||
results=results-1
|
||||
gid, game, faction, lastturn, sid, race, info = cursor.fetchone()
|
||||
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'
|
||||
if lastturn<maxturn[gid]:
|
||||
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>'
|
||||
|
@ -84,8 +86,8 @@ if Form.has_key("pass"):
|
|||
if (password!=None) & (custid!=None):
|
||||
cursor=db.cursor()
|
||||
output=""
|
||||
if cursor.execute("select email, id from users where password='"+password+"' and id="+str(int(custid)))==1:
|
||||
email, custid = cursor.fetchone()
|
||||
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 from subscriptions where status='CANCELLED'")
|
||||
while c>0:
|
||||
c=c-1
|
||||
|
@ -94,15 +96,23 @@ if (password!=None) & (custid!=None):
|
|||
update = db.cursor()
|
||||
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=smtplib.SMTP(smtpserver)
|
||||
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>"
|
||||
|
|
|
@ -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")
|
||||
print "CANCEL: "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games))
|
||||
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:
|
||||
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"
|
||||
|
|
|
@ -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')
|
||||
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+"'")
|
||||
print "Removing "+str(int(k))+" transfered subscriptions."
|
||||
k = cursor.execute("UPDATE subscriptions SET user=0, status='CANCELLED' where game="+str(int(game))+" and status='TRANSFERED' and updated<'"+date+"'")
|
||||
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+"'")
|
||||
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'")
|
||||
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))
|
||||
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))
|
||||
while k!=0:
|
||||
|
|
Loading…
Reference in New Issue