blob: 0384a843daf492f08b5f9f6fcfe593f481cf71a8 [file] [log] [blame]
mbligh94f07a22008-05-21 17:10:57 +00001#!/usr/bin/python
2
3import sys, os
4import MySQLdb
5import urllib, db, unique_cookie
6
mblighd34763f2008-06-06 14:28:10 +00007uid = unique_cookie.unique_id('tko_history')
8
9
mbligh94f07a22008-05-21 17:10:57 +000010def body():
11 db_obj = db.db()
mbligh94f07a22008-05-21 17:10:57 +000012 condition = "uid='%s'" % uid
13 where = (condition,[])
14 try:
15 rows = db_obj.select("time_created,user_comment,url",
mblighd34763f2008-06-06 14:28:10 +000016 "query_history", where)
mbligh94f07a22008-05-21 17:10:57 +000017 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 + "&nbsp;"*3
25 print user_comment + "<br>"
26 print '<a href="%s">%s</a>' % (tko_url, tko_url)
mblighd34763f2008-06-06 14:28:10 +000027 print '<hr>'
mbligh94f07a22008-05-21 17:10:57 +000028
29
30def 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
41main()
42
43