Hey Lisa,

it's very simple. You was on the right way!

The reason that you got the error 'header already sent': you did NOT use
header at the top of your script! There we're some bytes send to the client!

So your header only can be sent if the client did not receive some data!!!

Below an example of the structure of the script:


// form has been submitted
if(isset($submit) {

        // (check if password exists) {
                  Yes: header("Location: securepage.php");
        } else {
                 No : header("Location: error.php");
} else {
        // form has not been submitted
        // print form

        <input type='text' name='x'>
        <input type='submit' name='submit'>




Daniel Kieviet
Xsarus Internetdiensten

----- Original Message -----
From: "Rubanowicz, Lisa" <[EMAIL PROTECTED]>
Sent: Friday, June 22, 2001 3:23 AM
Subject: [PHP-DB] Password Protect page

> Hi All,
> I have an Admin section for my site (where users fill in web forms and it
> changes the site and upload facility for images) and would like a script
> that does a User Logon page.  Password is enough.  I have created a TABLE
> my mySQL database called bw_password with two fields id and password.
> Does anyone have a handy script.  I tried but to no avail, I was trying to
> send the header to redirect if the password in the input box matches the
> database password but it kept saying that the header was already sent..  I
> tried Javascript aswell, doing a location.href = "URL" within the "if"
> statement.
> If anyone can send me one they have and I can try and modify it then or at
> least understand it.  I am a beginner so please be nice!!
> Thanks in advance
> Lisa
> Lisa Rubanowicz
> Case ITC,
> Navan, Ireland
> Tel: #353 (0)46 77663

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to