[763] | 1 | #!/usr/bin/env python
|
---|
| 2 |
|
---|
| 3 | """
|
---|
| 4 | FCKeditor - The text editor for internet
|
---|
| 5 | Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
---|
| 6 |
|
---|
| 7 | Licensed under the terms of the GNU Lesser General Public License:
|
---|
| 8 | http://www.opensource.org/licenses/lgpl-license.php
|
---|
| 9 |
|
---|
| 10 | For further information visit:
|
---|
| 11 | http://www.fckeditor.net/
|
---|
| 12 |
|
---|
| 13 | "Support Open Source software. What about a donation today?"
|
---|
| 14 |
|
---|
| 15 | File Name: sampleposteddata.py
|
---|
| 16 | This page lists the data posted by a form.
|
---|
| 17 |
|
---|
| 18 | File Authors:
|
---|
| 19 | Andrew Liu (andrew@liuholdings.com)
|
---|
| 20 | """
|
---|
| 21 |
|
---|
| 22 | import cgi
|
---|
| 23 | import os
|
---|
| 24 |
|
---|
| 25 | # Tell the browser to render html
|
---|
| 26 | print "Content-Type: text/html"
|
---|
| 27 | print ""
|
---|
| 28 |
|
---|
| 29 | try:
|
---|
| 30 | # Create a cgi object
|
---|
| 31 | form = cgi.FieldStorage()
|
---|
| 32 | except Exception, e:
|
---|
| 33 | print e
|
---|
| 34 |
|
---|
| 35 | # Document header
|
---|
| 36 | print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 37 | <html>
|
---|
| 38 | <head>
|
---|
| 39 | <title>FCKeditor - Samples - Posted Data</title>
|
---|
| 40 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
---|
| 41 | <meta name="robots" content="noindex, nofollow">
|
---|
| 42 | <link href="../sample.css" rel="stylesheet" type="text/css" />
|
---|
| 43 | </head>
|
---|
| 44 | <body>
|
---|
| 45 | """
|
---|
| 46 |
|
---|
| 47 | # This is the real work
|
---|
| 48 | print """
|
---|
| 49 | <h1>FCKeditor - Samples - Posted Data</h1>
|
---|
| 50 | This page lists all data posted by the form.
|
---|
| 51 | <hr>
|
---|
| 52 | <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
|
---|
| 53 | <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
|
---|
| 54 | <td nowrap>Field Name </td>
|
---|
| 55 | <td>Value</td>
|
---|
| 56 | </tr>
|
---|
| 57 | """
|
---|
| 58 | for key in form.keys():
|
---|
| 59 | try:
|
---|
| 60 | value = form[key].value
|
---|
| 61 | print """
|
---|
| 62 | <tr>
|
---|
| 63 | <td valign="top" nowrap><b>%s</b></td>
|
---|
| 64 | <td width="100%%">%s</td>
|
---|
| 65 | </tr>
|
---|
| 66 | """ % (key, value)
|
---|
| 67 | except Exception, e:
|
---|
| 68 | print e
|
---|
| 69 | print "</table>"
|
---|
| 70 |
|
---|
| 71 | # For testing your environments
|
---|
| 72 | print "<hr>"
|
---|
| 73 | for key in os.environ.keys():
|
---|
| 74 | print "%s: %s<br>" % (key, os.environ.get(key, ""))
|
---|
| 75 | print "<hr>"
|
---|
| 76 |
|
---|
| 77 | # Document footer
|
---|
| 78 | print """
|
---|
| 79 | </body>
|
---|
| 80 | </html>
|
---|
| 81 | """
|
---|