Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation script problem *HELP!*

    I am using a very simple php login script. I need to know if there is a way to require someone to type in the password for another .php file.
    For example if I had the script in login.php and I had another file called protected.php could I add a line at the top of the php page to require the users to type in the password to see the content in protected.php? I have heard of the php require function but do not know how to use it???

    here is the code:
    PHP Code:
    <?PHP
    $pass 
    $_POST['pass']; 
    if (
    $pass == 'rightpassword') {
    echo 
    'right!';
    } elseif (
    $pass == '') {
    echo 
    '';
    } else {
    echo 
    'wrong';
    }
    ?>
    <HTML>
    <h1><font color="red">AUTHORIZATION REQUIRED</font></h1>
    <b><font color="red">Authorization is required past this point. You must enter the correct password to continue.</font></b>
    <form action="/login/" method="post">
    <input type="password" name="pass">
    <input type="submit">
    </form>
    </HTML>
    a live example can be found at : http://tst4php.6te.net/login/
    thanks to anyone who can help!

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why do you have popups when i go to the page to help you?

  • #3
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry it is because I am using free web hosting... can you help??


  •  

    Posting Permissions

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