예제 #1
0
                        </ul>
                      </li>
                      
                      <li><a href="Teachers.html">Teachers</a></li>
                      <li><a href="Calendar.html">Calendar</a></li>
                      <li><a href="Contact.html">Contact</a></li>
                    </ul>
                    <!-- Login PHP -->
                      <?php 
session_start();
require 'Session/login-session-handler.php';
$login_handler = new LoginSessionHandler();
// If submitting
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    // Login using the login information
    if ($login_handler->Login($_POST['email'], $_POST['password'])) {
        // Alert if success.
        echo "<script> alert('Email " . $login_handler->GetLoginInfo()['email'] . " has logged in.') </script>";
    } else {
        // Alert if unsusccessful.
        echo "<script> alert('Unsuccessfully logged in.') </script>";
    }
}
// Check if logged in and set visability.
if ($login_handler->IsLoggedIn()) {
    $login_visability = "hidden";
    $username_visablilty = "";
} else {
    $login_visability = "";
    $username_visablilty = "hidden";
}
<?php

/**
 * Created by PhpStorm.
 * User: ernestlandrito
 * Date: 12/7/15
 * Time: 10:16 PM
 */
session_start();
include 'login-session-handler.php';
// Make a login handler and login.
$login_handler = new LoginSessionHandler();
$login_handler->Login('*****@*****.**', 'test');