Пример #1
0
<?php

require_once "tools.php";
// common services and startup
?>

<html>
    <head>
        <title>Password</title>
    </head>
    <body>
        <?php 
if (!IsPasswordValid()) {
    ?>
        <form method="get">
            <div style="width: 600px;">
                <p>Editing contents in family database requires password to protect
                from undesired editing by outsiders. Please contact 
                <a href="mailto:robert@iki.fi">Robert J. Brotherus</a>
                to get the password if have sincere intention		
                of providing new/corrected data to the database. I apologize for
                the inconvenience.</p>
                <p>Password <input type="text" name="password"/></p>
                <p><input type="submit" value="Submit Password"/></p>
                <?php 
    if (isset($_REQUEST['password'])) {
        ?>
                <p style="font-weight: bold; color: red;">Invalid password, try again</p>	
                <?php 
    }
    ?>
Пример #2
0
function VerifyPassword()
{
    if (!IsPasswordValid()) {
        $origUrl = urlencode($_SERVER['REQUEST_URI']);
        Redirect("askPassword.php?origUrl={$origUrl}");
        die;
    }
}