Simple chat.cgi

From XPUB & Lens-Based wiki
Revision as of 17:10, 21 April 2015 by Michael Murtaugh (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#!/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())