/**
  * MĂ©thode d'initialisation de la session utilisateur.
  * 
  */
 static function Init()
 {
     if (isset($_POST['login'], $_POST['password'])) {
         Session::Login();
     } else {
     }
 }
 /**
  * 
  */
 static function Login()
 {
     require VIEW . '/v_header.php';
     $credentials = ['login' => Main::GetData()['login'], 'password' => Main::GetData()['password']];
     if (Session::IsUserLogged()) {
         header('Location: http://' . DOMAIN . '/home/display');
     } else {
         if (isset($credentials['login'], $credentials['password'])) {
             Session::Login($credentials);
         } else {
             require VIEW . '/www/v_login.php';
         }
     }
     require VIEW . '/v_footer.php';
 }
    if (isset($_COOKIE["cookie_username"]) && isset($_COOKIE["cookie_password"]) && isset($_COOKIE["cookie_userid"])) {
        $guardian->SetId($_COOKIE["cookie_userid"]);
        $guardian->SetUsername($_COOKIE["cookie_username"]);
        $guardian->SetEncryptedPassword($_COOKIE["cookie_password"]);
    } else {
        $guardian->SetUsername("guest");
        $guardian->SetPassword("guest");
    }
}
$guardian->SetModuleName($module_name);
if ($module_name != "error") {
    if (!$guardian->CheckPermission()) {
        echo "<script language='Javascript'>window.location = \"/" . $WEB_SITE . "pages/pgError.php\";</script>";
    } else {
        $session = new Session();
        $session->SetDatabase($database);
        if ($guardian->GetId() != "") {
            $session_id = $session->Login($guardian->GetId(), $guardian->GetUsername(), $guardian->GetEncryptedPassword());
        } else {
            $session_id = $session->Login($guardian->GetId(), $guardian->GetUsername(), $guardian->GetPassword());
        }
        $guardian->SetId($session_id);
        $guardian->SetLoggedIn($session->logged_in);
    }
}
/*	
	echo $_SERVER['QUERY_STRING']."<br>";
	echo $_SERVER['SCRIPT_NAME']."<br>";
	echo $_SERVER['HTTP_HOST']."<br>";
	echo $_SERVER['REQUEST_URI']."<br>";
*/
Example #4
0
<?php

require_once "includes/Params.ini.php";
require_once "includes/Autoload.php";
$page = isset($_GET['page']) ? $_GET['page'] : null;
$slug = isset($_GET['slug']) ? $_GET['slug'] : null;
$token = isset($_GET['token']) ? $_GET['token'] : null;
Site::setUrlParameters($page, $slug, $token);
if (MODLOGIN_ACTIVATE) {
    Session::Login();
    if (Site::get_page() == 'logout' && Session::Online()) {
        Session::Logout();
    }
    //Session::LoginAfterRegister();
}
require_once 'includes/Controller.php';
Example #5
0
<?php

/*
 * doLogin.php
 *
 * The login action.
 *
 * Written by: Bruno Schifer Bernardi
 * Last Updated: August 01, 2007
 */
require '../../schifers/constants/cdConstants.php';
require '../../' . $WEB_SITE . 'src/cdDatabase.php';
require '../../' . $WEB_SITE . 'src/cdUser.php';
require '../../' . $WEB_SITE . 'src/cdSession.php';
$username = $_POST["p_username"];
$password = $_POST["p_password"];
$id = $_POST["p_session_id"];
$user = new User();
$user->SetDatabase($database);
$user->SetUsername($username);
$user->SetPassword($password);
$user->Encrypt();
$session = new Session();
$session->SetDatabase($database);
$session->SetUser($user);
$session->Login($id, $username, $user->GetEncryptedPassword());
if ($session->IsLoggedIn()) {
    echo "<script language='Javascript'> window.location = \"/" . $WEB_SITE . "pages/pgRestricted.php\" </script>";
} else {
    echo "<script language='Javascript'> window.location = \"/index.php?error_message=Login Inválido!\" </script>";
}