| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
""" |
| 6 |
|
| 7 |
FCKeditor - The text editor for Internet - http://www.fckeditor.net |
| 8 |
|
| 9 |
Copyright (C) 2003-2009 Frederico Caldeira Knabben |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
== BEGIN LICENSE == |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
Licensed under the terms of any of the following licenses at your |
| 18 |
|
| 19 |
choice: |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
- GNU General Public License Version 2 or later (the "GPL") |
| 24 |
|
| 25 |
http://www.gnu.org/licenses/gpl.html |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
- GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
| 30 |
|
| 31 |
http://www.gnu.org/licenses/lgpl.html |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
- Mozilla Public License Version 1.1 or later (the "MPL") |
| 36 |
|
| 37 |
http://www.mozilla.org/MPL/MPL-1.1.html |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
== END LICENSE == |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
This page lists the data posted by a form. |
| 46 |
|
| 47 |
""" |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
import cgi |
| 52 |
|
| 53 |
import os |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
# Tell the browser to render html |
| 58 |
|
| 59 |
print "Content-Type: text/html" |
| 60 |
|
| 61 |
print "" |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
try: |
| 66 |
|
| 67 |
# Create a cgi object |
| 68 |
|
| 69 |
form = cgi.FieldStorage() |
| 70 |
|
| 71 |
except Exception, e: |
| 72 |
|
| 73 |
print e |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
# Document header |
| 78 |
|
| 79 |
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 80 |
|
| 81 |
<html> |
| 82 |
|
| 83 |
<head> |
| 84 |
|
| 85 |
<title>FCKeditor - Samples - Posted Data</title> |
| 86 |
|
| 87 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 88 |
|
| 89 |
<meta name="robots" content="noindex, nofollow"> |
| 90 |
|
| 91 |
<link href="../sample.css" rel="stylesheet" type="text/css" /> |
| 92 |
|
| 93 |
</head> |
| 94 |
|
| 95 |
<body> |
| 96 |
|
| 97 |
""" |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
# This is the real work |
| 102 |
|
| 103 |
print """ |
| 104 |
|
| 105 |
<h1>FCKeditor - Samples - Posted Data</h1> |
| 106 |
|
| 107 |
This page lists all data posted by the form. |
| 108 |
|
| 109 |
<hr> |
| 110 |
|
| 111 |
<table border="1" cellspacing="0" id="outputSample"> |
| 112 |
|
| 113 |
<colgroup><col width="80"><col></colgroup> |
| 114 |
|
| 115 |
<thead> |
| 116 |
|
| 117 |
<tr> |
| 118 |
|
| 119 |
<th>Field Name</th> |
| 120 |
|
| 121 |
<th>Value</th> |
| 122 |
|
| 123 |
</tr> |
| 124 |
|
| 125 |
</thead> |
| 126 |
|
| 127 |
""" |
| 128 |
|
| 129 |
for key in form.keys(): |
| 130 |
|
| 131 |
try: |
| 132 |
|
| 133 |
value = form[key].value |
| 134 |
|
| 135 |
print """ |
| 136 |
|
| 137 |
<tr> |
| 138 |
|
| 139 |
<th>%s</th> |
| 140 |
|
| 141 |
<td><pre>%s</pre></td> |
| 142 |
|
| 143 |
</tr> |
| 144 |
|
| 145 |
""" % (key, value) |
| 146 |
|
| 147 |
except Exception, e: |
| 148 |
|
| 149 |
print e |
| 150 |
|
| 151 |
print "</table>" |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
# For testing your environments |
| 156 |
|
| 157 |
print "<hr>" |
| 158 |
|
| 159 |
for key in os.environ.keys(): |
| 160 |
|
| 161 |
print "%s: %s<br>" % (key, os.environ.get(key, "")) |
| 162 |
|
| 163 |
print "<hr>" |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
# Document footer |
| 168 |
|
| 169 |
print """ |
| 170 |
|
| 171 |
</body> |
| 172 |
|
| 173 |
</html> |
| 174 |
|
| 175 |
""" |
| 176 |
|
| 177 |
|