Пример #1
0
    <?php 
create_nav_bar();
?>

    <div class="container" style="max-width: 330px;">

        <h3>
            Login
            <small>
                <small> (Not registered? <a href="create_account.php">Create account</a>)</small>
            </small>
        </h3>

        <?php 
if (form_submitted()) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    try {
        if (id_matches_db($username, $password)) {
            store_id_in_session($username);
            print_success_message('Login successful! You will be redirected to your home page shortly.');
            redirect('index.php');
        } else {
            print_error_message('Invalid username or password. Please try again.');
        }
    } catch (Exception $ex) {
        print_error_message('Invalid username or password. Please try again.');
    }
}
?>
<body>

<?php 
create_nav_bar();
?>

<div class="container" style="width: 500px">
    <div class="page-header">
        <h3>Create New Account
            <small>
                <small> (Already registered? <a href="login.php">Log in</a>)</small>
            </small>
        </h3>
    </div>
    <?php 
if (form_submitted() && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirm_password'])) {
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $confirm_password = $_POST['confirm_password'];
    $email = $_POST['email'];
    $organization = $_POST['organization'];
    $address = $_POST['address'];
    $country = $_POST['country'];
    $telephone = $_POST['telephone'];
    $mobile = $_POST['mobile'];
    $im = $_POST['im'];
    $url = $_POST['url'];
    if ($idStore->username_exists($username)) {
        print_error_message('The username you entered is already in use. Please select another.');
            <div><input class="form-control" id="new_password_again" maxlength="30" name="new_password_again"
                        placeholder="New password (again)" required="required" title="" type="password"/></div>
        </div>
        <br/>
        <input name="Submit" type="submit" class="btn btn-primary btn-block" value="Save">
        <input name="Password_Update" type="hidden" value="Password_Update">
    </form>
    <br/><br/>


    <div class="page-header">
        <h3>Update user profile</h3>
    </div>
    <?php 
if (form_submitted() && isset($_POST['Profile_Update'])) {
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $email = $_POST['email'];
    $organization = $_POST['organization'];
    $address = $_POST['address'];
    $country = $_POST['country'];
    $telephone = $_POST['telephone'];
    $mobile = $_POST['mobile'];
    $im = $_POST['im'];
    $url = $_POST['url'];
    if (!isset($first_name)) {
        print_error_message('First name is required.');
    } elseif (!isset($last_name)) {
        print_error_message('Last name is required.');
    } elseif (!isset($email)) {