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