Newvie Question About script linking
jdavis at empires.org
Tue Oct 8 11:11:58 CEST 2002
You need some type of authentication function on each python script. If you
want to protect an entire directory, you'll have to look into apache
Each python script could do the following:
(1) see if the appropriate cookie is set
(2) validate the user/password combination contained in the cookie
(3) if it's correct, then have the python script print out html code that
you want protected; if not, send a location header to redirect them to the
To send a location header, then you need to do:
print "Location: http://some.domain/some/path/login.cgi"
but you have to do that before you send any other output. That header tells
the browser to go to that new location. Then, they can log in and
hopefully this time they get their password right.
Daniel Lupton wrote:
> I am new to Python and I am creating a dynamic website using CGI
> in Python. I have a login page in one script and the rest of the site
> linked to a variety of other scripts.
> What I want to know is how do I get the script to load the Login page if
> their test of the cookie fails. i.e. if the user has not been validated
> and when the test fails the login page is brought up.
> I know how to do this with a html link but not through the python code
More information about the Python-list