Files
PHP-LDAP/login.php
2025-03-26 17:02:40 +01:00

33 lines
720 B
PHP

<?php
if (!isset($_POST["domain"]) || !isset($_POST["user"]) || !isset($_POST["password"])) {
require_once "templates/login_form.html";
exit;
}
$domain = rtrim($_POST["domain"]);
$user = rtrim($_POST["user"]);
$password = rtrim($_POST["password"]);
require_once "ldap.php";
$result = LdapConnect($domain, $user, $password, []);
ldap_parse_result($handle, $result, $error_code, $matched_dn, $error_message, $referrals, $controls);
if ($error_code != 0) {
require_once "templates/login_failed.html";
exit;
}
require_once "view/View.php";
$info = LdapGetUserInfo($user);
$body = PrintLoginInfo($info);
require_once "templates/login_success.html.php";
// TODO: style
// TODO: Mettre les tentatives dans la db