Results 1 to 2 of 2

Thread: Stopping Just Anyone From Viewing Pages

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Stopping Just Anyone From Viewing Pages

    Hi all,

    Ok well I set up a username/password scenario and was able to get it to work and the add the header to the main.php page, which loaded if the user/pass is correct. But then I realised I can access any of the pages just by typing in the link directly... What do I need to add, so that if people link to the page they need to login first...???

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    On the page when logged in, use the following at the top of the document:
    Code:
    <?php
    if ($user != "myusername" || $pass != "mypassword") {
    die("Incorrect username or password");
    }
    ?>
    - Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •