Simple chat.cgi: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<source lang="python"> #!/usr/bin/python import datetime import cgitb; cgitb.enable() import cgi i = cgi.FieldStorage() message = i.getvalue("message", "") print "Content-ty...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[How am I being served]]
    python -m CGIHTTPServer
cgi-bin/chat.cgi
<source lang="python">
<source lang="python">
#!/usr/bin/python
#!/usr/bin/python

Latest revision as of 18:12, 21 April 2015

How am I being served

   python -m CGIHTTPServer


cgi-bin/chat.cgi

#!/usr/bin/python
import datetime
import cgitb; cgitb.enable()
import cgi

i = cgi.FieldStorage()
message = i.getvalue("message", "")

print "Content-type:text/html"
print
print "<h1>Hello</h1>"
print '''
<link rel="stylesheet" href="/birthday.css" >
<form action="">
<input type="text" name="message" autofocus><br>
<input type="submit">
</form>

'''

print "You said {0}".format(message.upper())