i want to password protect, i may have a page or pages that i don't want anyone view page, such as an administrative page.

    A simple way to so is by making a form which looks like a login page with username & password Textfields.<form method=post action=login.php>

    Then in the login.php page, write the following code:
    <?php
    if ($username == 'USERNAME' && $password == 'PASSWORD'){
    header ("Location:admin.php");
    }else{
    header ("Location:wrongpassword.php");
    }
    ?>

      Just make sure your admin pages make a similar validity check... otherwise a user could simply enter the admin URL and vector right there.

      Dave

      ===========================================
      http://badblue.com/helpphp.htm
      Free small footprint web server for Windows

      PHP, P2P file-sharing, transcoding and more

        • [deleted]

        Put the admin pages into a sub directory and use the standard authentication of your webserver to protect them.

          If you are using Apache, check out .htaccess files. For IIS I think there is some sort of NT User Auth which works similar to .htaccess.

            Write a Reply...