From bb3b1bd8bbc882498aff9aaa6710c8aacb180582 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 2 Apr 2002 22:33:07 +0000 Subject: [PATCH] updates to transfers --- scripts/cgi-bin/standin.py | 26 ++++++++++++++++++-------- scripts/register/duplicates.py | 30 ++++++++++++++++++++++++++++++ scripts/register/warn.py | 2 +- scripts/register/zat.py | 14 +++++++++----- 4 files changed, 58 insertions(+), 14 deletions(-) create mode 100755 scripts/register/duplicates.py diff --git a/scripts/cgi-bin/standin.py b/scripts/cgi-bin/standin.py index 980193753..acffe9e47 100755 --- a/scripts/cgi-bin/standin.py +++ b/scripts/cgi-bin/standin.py @@ -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+''+ race + ''+ game + '' + str(int(maxturn[gid]-lastturn)) + '' + info + '' - output=output+' übernehmen\n' + if lastturn'+ race + ''+ game + '' + str(int(maxturn[gid]-lastturn)) + '' + info + '' + output=output+' übernehmen\n' output=output+'' output=output+'

' @@ -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.
" + 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="Fehler in Passwort oder Kundennummer
" 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/warn.py b/scripts/register/warn.py index e367b6287..456436523 100755 --- a/scripts/register/warn.py +++ b/scripts/register/warn.py @@ -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" diff --git a/scripts/register/zat.py b/scripts/register/zat.py index b7df75aa3..958498f28 100755 --- a/scripts/register/zat.py +++ b/scripts/register/zat.py @@ -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:
Kundennummer:
Passwort: