opensmtpdadmin/users/login.php

55 lines
1.2 KiB
PHP
Raw Normal View History

2022-08-18 14:01:52 +02:00
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: login.php
//
// Template File: login.tpl
//
// Template Variables:
//
// tMessage
// tUsername
//
// Form POST \ GET Variables:
//
// fUsername
// fPassword
//
require("../variables.inc.php");
require("../config.inc.php");
require("../functions.inc.php");
include("../languages/" . check_language() . ".lang");
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$fUsername = escape_string($_POST['fUsername']);
$fPassword = escape_string($_POST['fPassword']);
$result = db_query("SELECT password FROM mailbox WHERE username='$fUsername' AND active='1'");
if ($result['rows'] == 1) {
$row = db_array($result['result']);
2022-09-03 11:30:40 +02:00
if (!password_verify($fPassword, $row['assword'])) {
2022-08-18 14:01:52 +02:00
$error = 1;
2022-09-03 11:30:40 +02:00
$tMessage = $LANG['Login_password_incorrect'];
2022-08-18 14:01:52 +02:00
$tUsername = $fUsername;
}
} else {
$error = 1;
2022-09-03 11:30:40 +02:00
$tMessage = $LANG['Login_username_incorrect'];
2022-08-18 14:01:52 +02:00
}
if ($error != 1) {
session_start();
$_SESSION['userid']['username'] = $fUsername;
header("Location: main.php");
exit;
}
}
include("../templates/header.tpl");
include("../templates/users_login.tpl");
include("../templates/footer.tpl");
?>