Example #1
0
<?php

include "lib/init.php";
//general php implements 3 operations login, logout, register
$action = $_GET["action"];
$method = $_SERVER["REQUEST_METHOD"];
switch ($action) {
    case "login":
        if ($method === "GET") {
            general::displayLoginForm();
        } elseif ($method === "POST") {
            general::handleLogin();
        }
        break;
    case "register":
        if ($method === "GET") {
            general::displayRegisterForm();
        } elseif ($method === "POST") {
            general::handleRegister();
        }
        break;
    case "registerOK":
        general::displayRegisterOKPage();
        break;
    case "logout":
        general::logout();
        break;
}
class general
{
    public static function displayLoginForm($vars = array())