#!/usr/bin/python # # Copyright (c) 2006, Ingo Juergensmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # feedback.phtml comes with ABSOLUTELY NO WARRANTY # import psycopg from string import * from time import * import cgi, sys, os import popen2 import tempfile import smtplib homedir="/home/builddnet" f = open(homedir+"/conf.d/database.conf") while 1: line = f.readline() if len(line)==0: break if line.count("host"): host = split(line,"=")[1] elif line.count("port"): port = split(line,"=")[1] elif line.count("username"): username = split(line,"=")[1] elif line.count("password"): password = split(line,"=")[1] elif line.count("database"): database = split(line,"=")[1] # mailserver connection smtp = smtplib.SMTP('localhost') #dsn = "dbname=buildd" dsn = "dbname=%s host=%s user=%s password=%s" % ( database, host, username, password ) db = psycopg.connect(dsn) csr = db.cursor() error=0 selected = "" remote_ip=os.environ['REMOTE_ADDR'] remote_addr=os.environ['REMOTE_HOST'] user_agent=os.environ['HTTP_USER_AGENT'] archs=["alpha","amd64","arm","armeb", "hppa", "hurd-i386", "i386","ia64","kfreebsd","netbsd-alpha", "netbsd-i386","m32r","m68k","mips","mipsel","sh", "powerpc","s390","sparc"] # default text.. maildate = strftime("Date: %a, %d %b %Y %H:%M:%S +0000", gmtime()) mailfrom = '"Buildd.net" ' footer = "\n\nRegards,\nIngo Juergensmann" #footer = footer + "\n\n-- \nMecklenburgischer Yachtclub Rostock e.V.\nhttp://www.mycr.de/ * versendet via check_odienst.py" #webpage = "http://www.mycr.de" subject = "User Feedback" # to prevent things like "MYCR - Ordnungsdienst am 07.04.2005 am 13.04.2005" body0 = """Someone had entered the following lines at buildd.net as feedback:\nRemote IP: %s\nRemote Host: %s\n\n""" % (remote_ip, remote_addr) def init(): #print remote_ip, remote_addr, user_agent, "
" #print os.environ print '' #print '
' print '
' #print '
' print ' Your personal data:

' print ' Name:

' print ' eMail address:

' print ' Subject:

' print ' Feedback:

' print ' ' #print '

' print '' print '' return def addentry(): #print "
ADD ENTRY" if (form.has_key('name') and form.has_key('email')): name = replace(replace(form['name'].value, "'", ""), "\\", "") email = replace(replace(form['email'].value, "'", ""), "\\", "") archstring = "" archvalue = "" if form.has_key('subject'): subject = "buildd.net feedback: "+form['subject'].value else: subject = "buildd.net feedback" if form.has_key('usage'): usage = form['usage'].value else: usage = "Null" body = "%s\nFrom: %s\nReply-To: %s\nTo: buildd.net feedback \nSubject: %s\n" % ( maildate, mailfrom, email, subject ) body = body + body0 + usage #body = body + footer #print mailfrom #print email #print subject #print body smtp.sendmail(mailfrom, 'ij@buildd.net', body) #print rc else: print "Please enter a valid name and a valid email address.
" return def httperror(): print """You're not allowed here. Spam elsewhere. Go away!""" print "" db.close() sys.exit(0) # # Main() # print "Content-type: text/html" print """ www.buildd.net - feedback

Buildd.net - Feedback


""" if len(user_agent)<10: httperror() print """Your feedback is welcome!
If you have ideas how to improve buildd.net, questions about some stuff on buildd.net or even some criticism what is not so good, please drop me a note! Enter the form below and click on the 'Send Feedback' button.
Please enter valid names and a valid email address, so I can answer to your feedback if necessary.

""" form = cgi.FieldStorage() #print form if form.has_key('change'): change() elif form.has_key('addentry'): addentry() init() elif form.has_key('id'): change() else: init() print """


Ingo Juergensmann, Sat Nov 12 11:41:21 CET 2005
""" print "
" db.close() sys.exit(0)