From cadccb9804fc7ec27d91dea897b277b2b5349bd5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 2 Jan 2002 16:04:23 +0000 Subject: [PATCH] form test --- scripts/cgi-bin/info.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/scripts/cgi-bin/info.py b/scripts/cgi-bin/info.py index 48a434079..4d28f082e 100755 --- a/scripts/cgi-bin/info.py +++ b/scripts/cgi-bin/info.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import MySQLdb @@ -18,13 +18,16 @@ smtpserver = 'localhost' def Display(Content, Title=DefaultTitle): TemplateHandle = open(TemplateFile, "r") # open in read only mode # read the entire file as a string - TemplateInput = TemplateHandle.read() + TemplateInput = TemplateHandle.read() TemplateHandle.close() # close the file - + + for field in Form.keys(): + Content=Content+"
"+key+"="+Form[key] + # this defines an exception string in case our # template file is messed up BadTemplateException = "There was a problem with the HTML template." - + SubResult = re.subn("", Title, TemplateInput) SubResult = re.subn("", Content, SubResult[0]) if SubResult[1] == 0: @@ -48,7 +51,7 @@ def ShowInfo(custid, Password): #print query results = cursor.execute(query); if results > 0: - + output = "
Letzte Aktualisierung: "+str(lastdate)[0:10]+"
\n" while results>0: results = results - 1 @@ -66,10 +69,10 @@ def ShowInfo(custid, Password): output=output+"
" - query = ("select games.name, races.name, subscriptions.status, subscriptions.faction "+ - "from races, games, subscriptions "+ - "where subscriptions.race=races.race and subscriptions.game=games.id "+ - "and subscriptions.user="+str(custid)+" "); + query = ("select games.name, races.name, s.status, s.faction "+ + "from races, games, subscriptions s "+ + "where s.race=races.race and s.game=games.id "+ + "and s.user="+str(custid)+" "); results = cursor.execute(query); @@ -88,7 +91,7 @@ def ShowInfo(custid, Password): output=output+"" query="select date, balance, text from transactions, descriptions where descriptions.handle=transactions.description and user="+str(custid) - + results = cursor.execute(query); output=output+"

Transaktionen

\n
\n" @@ -104,11 +107,11 @@ def ShowInfo(custid, Password): output=output+line output=output+"
" -# output=output+"
" + output=output+"
" output=output+"
" else: output = "Die Kundennummer oder das angegebene Passwort sind nicht korrekt." - + Display(output, "Kundendaten #"+str(custid)) def SendPass(custid): @@ -130,10 +133,14 @@ def SendPass(custid): Form = cgi.FieldStorage() +if Form.has_key("user"): + custid = int(Form["user"].value) + if Form.has_key("user"): custid = int(Form["user"].value) else: custid = 0 + if Form.has_key("pass"): Password = Form["pass"].value else: