what's wrong with this cookie script

QdlatY qdlaty at ikom.pl
Wed Jan 16 10:56:47 CET 2002


Hello :-)

I have something like this:

#!python
import cgi, Cookie, time

form = cgi.FieldStorage()
c = Cookie.SmartCookie()

if form.has_key("register"):
	c["name"] = form["name"].value
	c["name"]["expires"] = 99999999#time.time() + 60
	c["email"] = form["email"].value 
	c["email"]["expires"] = 99999999#time.time() + 60
	print c

print "Content-type: text/html; charset=ISO-8859-2\n\n"

if not c.has_key("name"):
	print """<FORM ACTION=cgi_dem.cgi METHOD=POST>
	Podaj swoje imie: <BR><INPUT NAME=name> <BR>
	Podaj swoj adres e-mail<BR><INPUT NAME=email><BR>
	<INPUT TYPE=HIDDEN NAME=register VALUE=true>
	<INPUT TYPE=SUBMIT></FORM>"""
else:
	print "Proba odczytu danych z ciastka:<BR>"
	if c.has_key("name"): print "Twoje imie:", c["name"].value, "<BR>"
	if c.has_key("email"): print "Twoj e-mail:", c["email"].value

I tried this on windows apache. Anyway, after i rerun IE, the cookie does 
not exists. What is wrong? Can anybody test this ?

-- 
QdlatY
mailto: qdlaty at ikom.pl
"Jezeli wydaje Ci sie ze wiesz wszystko - masz racje - wydaje Ci sie..."



More information about the Python-list mailing list