Example #1
0
<?php

require_once '../../includes/initialize.php';
if ($session->is_logged_in()) {
    redirect_to("index.php");
}
if (isset($_POST['submit'])) {
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    //Check database to see if username/password exist.
    $found_user = User::anthenticate($username, $password);
    if ($found_user) {
        $session->login($found_user);
        redirect_to("index.php");
    } else {
        $message = "Username/password combination incorrect.";
    }
} else {
    //Form has not been submitted
    $username = "";
    $password = "";
}
?>
<html>
<title>Photo Gallery</title>
<link href="../stylesheets/main.css" media="all" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="header">
    <h1>Photo Gallery</h1>
</div>