Location: PHPKode > projects > C.A.S.I.M.I.R. > casimir/index.php
<?php

include_once('include/config.php');
include_once('include/topmenu.php');
include_once('classes/mysql.class.php');
include_once('include/use_template.php');
$page_title = 'Accueil';

session_start();
if (!isset($_SESSION['login'])) { //Then no user is logged in

    $locations = BuildTopMenu($page_title, -1, $EXTERNAL_LINKS);
    $actions = array();

	if (empty($_POST['login']) && (!isset($_SERVER['REMOTE_USER']) || isset($_GET['no_ntlm']))) { //No login attempt
        $content = '
    <form action="index.php" method="post" name="ident">
    
    <p> Identifiant : <br>
        <input name="login" value="" size="63" /> 
    </p>
    
    <p> Mot de passe : <br>
        <input name="password" type="password" value=""> 
        
        <input type="submit" value="Submit">
        
    </p>
	</form>';
        $mainframe = array( 'Connexion' => array ( 'Saisissez vos informations :' => $content));
	}
	else { // A user is attempting to log in
        $DB = new MySQL($MYSQL_SERVER, $MYSQL_DATABASE, $MYSQL_USER, $MYSQL_PASSWORD);
        if (isset($_SERVER['REMOTE_USER']) && !isset($_POST['login'])) {
            $login = $_SERVER['REMOTE_USER'];
            $login_info = $DB->CheckLogin($login,'','NTLM');
        } else {
            $login = $_POST['login'];
    		$login_info = $DB->CheckLogin($login, $_POST['password']);
        }
		if ($login_info == array()) {
			$mainframe = array('Echec de la connexion' => array('Veuillez vous identifier à nouveau' => $login.' n\'a pas pu être identifié.'));
			$actions = array('Authentification' => array('Sans NTLM' => '?no_ntlm=1'));
		}
        else { //Connexion successfull :)
            $_SESSION['login'] = $login_info['Login'];
            $_SESSION['FullName'] = $login_info['FullName'];
            $_SESSION['user_id'] = $login_info['User_ID'];
            $_SESSION['rights'] = $login_info['Rights'];
        }
	}
}
if (isset($_SESSION['login'])) { //Then a user is logged in
    $locations = BuildTopMenu($page_title, $_SESSION['rights'], $EXTERNAL_LINKS);
    $actions = array ('Mon compte' => array ('Déconnecter' => 'logout.php'));
    $mainframe = array('Connexion résussie !' => array('Bienvenue '.$_SESSION['FullName'] => 'Utilisez les liens ci-dessus pour utiliser le site.'));
}

BuildPage($page_title, $locations, $mainframe, $actions);

?>
Return current item: C.A.S.I.M.I.R.