Am Ende des Skript in der Zeile print "Content-Type: text/html"
kommt immer wieder ein Fehler.Vielleicht habe ich was übersehen.
Ich habe schon alles ausprobiert aber nichts hat geholfen.
Weiß jemand was das sein kann????
Code: Alles auswählen
#!E: \python24\python.exe
import MySQLdb, cgi, md5, pickle
name=""
passwort=""
form=cgi.FieldStorage()
passwort=form["passwort"].value
name=form["name"].value
try:
f=open(r'E:\dev\server/user.dat')
userdaten=pickle.load(f)
f.close()
except:userdaten={}
antwortrichtig='''<html>
<head><title>Agressbuch</title></head>
<body>
<h1>Adressbuch </h1>
Bitte geben Sieentweder PLZ oder Stadt ein.<br><p>
<form action="http://localhost:8000/cgi-bin/xxx.py"
method="POST">
<input type"text" name="adresse" size="20" maxlength="20">
<input type="submit" value="Suchen">
<input type="hidden" name ="name" value="%s">
<input type="hidden" name ="passwort" value="%s">
</form> </body> </html> ''' %(name, passwort)
antwortfalsch='''<html>
<head><title>Agressbuch</title></head>
<body>
<h1 align="center"> </h1>
<h1 align="center"> </h1>
<h1 align="center">Adressbuch </h1>
<div align="center">
<p> </p>
<p> Bitte geben Sie Benutzername und Passwort ein.<br>
</p>
</div>
<p>
<action="http://localhost:8000/cgi-bin/ablogin.py"
method="POST">
<p align="center">Name:
<input type="text" name ="name" size="20" maxlenggth="20">
<p align="center">Passwort:
<input type="Password" name ="passwort" size="16" maxlenggth="16">
<br>
<input type="submit" value="Login">
</form>
<h3>Falsches Passwort oder Benutzername<h3>
</body> </html> '''
ok=0
m=md5.new()
m.update(name+passwort)
if userdaten.has_key(name):
if userdaten[name]==m.digetest(): ok=1
print "Content-Type: text/html"
print
if ok:print antwortrichtig
else: print antwortfalsch