From dfc48eff2473208ff87ea515558a83d3c934407d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 13 Jan 2002 11:48:32 +0000 Subject: [PATCH] an- und abmeldung implementiert --- scripts/cgi-bin/info.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/scripts/cgi-bin/info.py b/scripts/cgi-bin/info.py index 2dbd60ce8..76b28b5d0 100755 --- a/scripts/cgi-bin/info.py +++ b/scripts/cgi-bin/info.py @@ -22,8 +22,8 @@ def Display(Content, Title=DefaultTitle): TemplateInput = TemplateHandle.read() TemplateHandle.close() # close the file -# for key in Form.keys(): -# Content=Content+"
"+str(key)+"="+str(Form[key]) + 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 @@ -78,7 +78,7 @@ def ShowInfo(custid, Password): results = cursor.execute(query); output=output+"

Anmeldungen

\n
\n" - output=output+"\n" + output=output+"\n" while results>0: results = results - 1 row = cursor.fetchone() @@ -87,13 +87,18 @@ def ShowInfo(custid, Password): line = line + '\n' line = line + '\n' line = line + '\n' - line = line + '\n' + line = line + '\n' line = line + '\n' output=output+line output=output+"
SpielRasseStatusParteiAbmelden
SpielRasseStatusParteiAn-/Abmelden
'+row[1]+''+row[2]+''+row[3]+'' + if row[2]=='ACTIVE': + line = line + '' + if row[2]=='CANCELLED': + line = line + '' + line = line + '
" - query="select date, balance, text from transactions, descriptions where descriptions.handle=transactions.description and user="+str(custid) + query="select date, balance, text from transactions, descriptions where descriptions.handle=transactions.description and user="+str(custid)+" ORDER BY date" results = cursor.execute(query); output=output+"

Transaktionen

\n
\n" @@ -128,16 +133,20 @@ def Save(custid, Password): cursor=db.cursor() cursor.execute('UPDATE users SET '+values+' where id='+str(custid)) - nfactions = cursor.execute("select game, id, faction from subscriptions where status='ACTIVE' and user="+str(custid)) + nfactions = cursor.execute("select 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: game, sid, faction = cursor.fetchone() if Form.has_key("cancel_"+faction): - update = db.cursor("UPDATE subscriptions set status='CANCELLED' where id="+str(sid)) - server=smtplib.SMTP(smtpserver) - Msg="From: accounts@vinyambar.de\nTo: admin@vinyambar.de\nSubject: Vinambar Abmeldung\n\n" - Msg=Msg+"Die Partei: "+faction+" hat sich aus Spiel Nr. "+game+" abgemeldet\n" - server.sendmail("accounts@vinyambar.de", "admin@vinyambar.de", Msg) - server.close() + update = db.cursor() + update.execute("UPDATE subscriptions set status='CANCELLED' where id="+str(sid)) + 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(sid)) nfactions = nfactions - 1 db.close()