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