mbligh | 94f07a2 | 2008-05-21 17:10:57 +0000 | [diff] [blame^] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import sys, os |
| 4 | import MySQLdb |
| 5 | import urllib, db, unique_cookie |
| 6 | |
| 7 | def body(): |
| 8 | db_obj = db.db() |
| 9 | uid = unique_cookie.unique_id('tko_history') |
| 10 | condition = "uid='%s'" % uid |
| 11 | where = (condition,[]) |
| 12 | try: |
| 13 | rows = db_obj.select("time_created,user_comment,url", |
| 14 | "query_history", where) |
| 15 | except MySQLdb.ProgrammingError, err: |
| 16 | print err |
| 17 | rows = () |
| 18 | |
| 19 | for row in rows: |
| 20 | (time_created, user_comment, tko_url) = row |
| 21 | print "<hr>" |
| 22 | print time_created + " "*3 |
| 23 | print user_comment + "<br>" |
| 24 | print '<a href="%s">%s</a>' % (tko_url, tko_url) |
| 25 | |
| 26 | |
| 27 | def main(): |
| 28 | print "Content-type: text/html\n" |
| 29 | print |
| 30 | # create the actual page |
| 31 | print '<html><head><title>' |
| 32 | print 'History of TKO usage' |
| 33 | print '</title></head><body>' |
| 34 | body() |
| 35 | print '</body></html>' |
| 36 | |
| 37 | |
| 38 | main() |
| 39 | |
| 40 | |