canceling

This commit is contained in:
Enno Rehling 2002-01-13 11:32:05 +00:00
parent 666fb81e14
commit 0d7e25dc4e

View file

@ -7,7 +7,7 @@ import re
import smtplib
# specify the filename of the template file
scripturl="http://eressea.upb.de/~enno/cgi-bin/info.cgi"
scripturl="http://eressea.upb.de/~enno/cgi-bin/info.py"
TemplateFile = "vinyambar.html"
DefaultTitle = "Vinyambar Datenbank"
dbname = "vinyambar"
@ -78,16 +78,17 @@ def ShowInfo(custid, Password):
results = cursor.execute(query);
output=output+"<h3>Anmeldungen</h3>\n<div align=left><table width=80% border>\n"
output=output+"<tr><th>Spiel</th><th>Rasse</th><th>Status</th><th>Partei</th></tr>\n"
output=output+"<tr><th>Spiel</th><th>Rasse</th><th>Status</th><th>Partei</th><th>Abmelden</th></tr>\n"
while results>0:
results = results - 1
row = cursor.fetchone()
line = "<tr>"
line = line + "<td align=left>"+row[0]+"</td>\n"
line = line + "<td align=left>"+row[1]+"</td>\n"
line = line + "<td align=left>"+row[2]+"</td>\n"
line = line + "<td align=left>"+row[3]+"</td>\n"
line = line + "</tr>\n"
line = line + '<td align="left">'+row[0]+'</td>\n'
line = line + '<td align="left">'+row[1]+'</td>\n'
line = line + '<td align="left">'+row[2]+'</td>\n'
line = line + '<td align="left">'+row[3]+'</td>\n'
line = line + '<td align="left"><input type="checkbox" name="cancel" value="cancel_' + row[3] + '"></td>\n'
line = line + '</tr>\n'
output=output+line
output=output+"</table></div>"
@ -126,6 +127,19 @@ def Save(custid, Password):
db = MySQLdb.connect(db=dbname)
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))
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()
nfactions = nfactions - 1
db.close()
ShowInfo(custid, Password)
# Display("Noch nicht implementiert", "Daten speichern für Kunde #"+str(custid))