refactor
This commit is contained in:
30
index.php
30
index.php
@@ -1,3 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
phpinfo();
|
|
||||||
?>
|
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 "src/ldap.php";
|
||||||
|
|
||||||
|
$result = LdapIsConnected($domain, $user, $password, []);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
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";
|
||||||
|
|||||||
27
login.php
27
login.php
@@ -1,27 +0,0 @@
|
|||||||
<?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 = LdapIsConnected($domain, $user, $password, []);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
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";
|
|
||||||
Reference in New Issue
Block a user