Use setCookie()  function. It places a global variable on the client that
your programs can verify after. See the manual for the use of the function.
Here is an example:

// Example of file chkacces.php.
<?php

$pass = $_POST['password'];        // It receives the password from a <FORM>
with POST method.

    if( ($pass != "xyz" ){            // where "xyz" is the right password.
        echo "You are not autorized to see this page";
        return;
    }

// Autorized.
setCookie( $USER, "autorized" );

header( "Location: index.php" );        // redirects to index.php

?>

Example for your index.php file:

<?php

    if( ($USER != "autorized" ){
        echo "You are not autorized to see this page";
        return;
    }

// Here goes the code for autorized users.

?>

The variable set with setCookie() is not availabe until the script ends. See
details in the manual.
The manual is available in www.php.org

"Sagerat" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> How do I set up password on a page so that only restricted people can open
> it?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to