HTMLファイル読み込み・パスワード認証
#! /usr/bin/python
# coding: Shift_JIS
import cgi
FORM = cgi.FieldStorage()
password = "1234"
print "Content-type: text/html"
if FORM.getvalue("pass", "") == password:
print ""
print open("../../sample/sample1.html", "r").read()
else:
print """
<html>
<head>
<title>パスワード認証</title>
</head>
<body>
<form action="" method="POST">
パスワードを入力してください。<br>
<input type="password" name="pass" value="" size="5">
<input type="submit" value="送信">
</form>
</body>
</html>
"""
〔 実行する 〕