diff --git a/users/index.php b/users/index.php deleted file mode 100644 index 67a1dda..0000000 --- a/users/index.php +++ /dev/null @@ -1,22 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: index.php -// -// Template File: -none- -// -// Template Variables: -// -// -none- -// -// POST / GET Variables: -// -// -none- -// -header("Location: login.php"); -exit; -?> diff --git a/users/login.php b/users/login.php deleted file mode 100644 index d940d52..0000000 --- a/users/login.php +++ /dev/null @@ -1,55 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: login.php -// -// Template File: login.tpl -// -// Template variables: -// -// message -// username -// -// GET / POST variables: -// -// username -// password -// -require_once '../functions.inc.php'; -include '../languages/' . check_language () . '.lang'; - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $username = filter_input(INPUT_POST, 'username', FILTER_VALIDATE_EMAIL); - $password = filter_input(INPUT_POST, 'password', FILTER_DEFAULT); - - if (!empty($username) && !empty($password)) { - $dbh = pdo_connect(); - $sth = $dbh->prepare("SELECT password FROM mailbox WHERE username=?"); - $sth->bindParam(1, $username, PDO::PARAM_STR); - $sth->execute(); - $row = $sth->fetch(PDO::FETCH_COLUMN); - } - - if (!empty($row)) { - if (!password_verify($password, $row)) { - $message = $LANG['Login_incorrect']; - } - } else { - $message = $LANG['Login_incorrect']; - } - - if (empty($message)) { - session_start(); - $_SESSION['userid']['username'] = $username; - header("Location: password.php"); - exit; - } -} -include '../templates/header.tpl'; -include '../templates/users_login.tpl'; -include '../templates/footer.tpl'; -?> diff --git a/users/logout.php b/users/logout.php deleted file mode 100644 index 24e0b03..0000000 --- a/users/logout.php +++ /dev/null @@ -1,29 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: logout.php -// -// Template File: -none- -// -// Template Variables: -// -// -none- -// -// POST / GET Variables: -// -// -none- -// -require_once '../functions.inc.php'; - -$USERID_USERNAME = check_session('userid'); - -session_unset(); -session_destroy(); - -header("Location: login.php"); -exit; -?> diff --git a/users/password.php b/users/password.php deleted file mode 100644 index 87b627e..0000000 --- a/users/password.php +++ /dev/null @@ -1,68 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: password.php -// -// Template File: password.tpl -// -// Template Variables: -// -// message -// -// POST / GET Variables: -// -// password_current -// password1 -// password2 -// -require_once '../functions.inc.php'; -include '../languages/' . check_language() . '.lang'; - -$SESSID_USERNAME = check_session('userid'); -$admin = $SESSID_USERNAME ?? ADMIN_EMAIL; - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $username = $SESSID_USERNAME; - $password_current = filter_input(INPUT_POST, 'password_current', FILTER_DEFAULT); - $password1 = filter_input(INPUT_POST, 'password1', FILTER_DEFAULT); - $password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT); - - if (empty($password_current) || empty($password1) || $password1 != $password2) { - $message = $LANG['Password_password_text_error']; - } - - if (empty($message) && !empty($password_current)) { - $dbh = pdo_connect(); - $sth = $dbh->prepare("SELECT password FROM mailbox WHERE username=?"); - $sth->bindParam(1, $username, PDO::PARAM_STR); - $sth->execute(); - $row = $sth->fetch(PDO::FETCH_COLUMN); - if (!password_verify($password_current, $row)) { - $message = $LANG['Password_password_current_text_error']; - } - } - - if (empty($message) && !empty($password1)) { - $hashed = bcrypt($password1); - try { - $dbh = pdo_connect(); - $sth = $dbh->prepare("UPDATE mailbox SET password=?,modified=NOW() WHERE username=?"); - $sth->bindParam(1, $hashed, PDO::PARAM_STR); - $sth->bindParam(2, $username, PDO::PARAM_STR); - $sth->execute(); - logging($admin, substr(strrchr($SESSID_USERNAME, "@"), 1), $LANG['Logging_password_change'], $admin); - $message = $LANG['Password_result_succes']; - } catch(PDOException $e) { - $message = $LANG['Password_result_error']; - } - } -} -include '../templates/header.tpl'; -include '../templates/users_menu.tpl'; -include '../templates/password.tpl'; -include '../templates/footer.tpl'; -?> diff --git a/users/vacation.php b/users/vacation.php deleted file mode 100644 index 5d9e5f4..0000000 --- a/users/vacation.php +++ /dev/null @@ -1,81 +0,0 @@ - -// Copyright (c) 2022 High5! -// License Info: LICENSE.TXT -// -// File: vacation.php -// -// Template File: users_vacation.tpl -// -// Template Variables: -// -// tMessage -// tSubject -// tBody -// -// POST / GET Variables: -// -// fSubject -// fBody -// -require_once '../functions.inc.php'; -include '../languages/' . check_language() . '.lang'; - -$SESSID_USERNAME = check_session('userid'); -$USERID_DOMAIN = substr(strrchr($SESSID_USERNAME, "@"), 1); - -if ($_SERVER['REQUEST_METHOD'] == "GET") { - $dbh = pdo_connect(); - $sth = $dbh->prepare("SELECT COUNT(*) FROM vacation WHERE email=?"); - $sth->execute(array($SESSID_USERNAME)); - - if ($sth->fetchColumn() == 1) { - $action = 'back'; - $message = $LANG['UsersVacation_welcome_text']; - } else { - $action = 'away'; - } -} - -if ($_SERVER['REQUEST_METHOD'] == "POST") { - $subject = filter_input(INPUT_POST, 'subject', FILTER_DEFAULT); - $body = filter_input(INPUT_POST, 'body', FILTER_DEFAULT); - - if (!empty($_POST['back'])) { - $action = 'back'; - $dbh = pdo_connect(); - $sth = $dbh->prepare("DELETE FROM vacation WHERE email=?"); - $sth->bindParam(1, $SESSID_USERNAME, PDO::PARAM_STR); - $sth->execute(); - if ($sth->rowCount() != 1) { - $message = $LANG['UsersVacation_result_error']; - } else { - $action = 'away'; - $essage = $LANG['UsersVacation_result_succes']; - } - } - - if (!empty($_POST['away'])) { - $action = 'away'; - try { - $dbh = pdo_connect(); - $sth = $dbh->prepare("INSERT INTO vacation (email,subject,body,cache,domain,created) VALUES (?,?,?,'',?,NOW())"); - $sth->bindParam(1, $SESSID_USERNAME, PDO::PARAM_STR); - $sth->bindParam(2, $subject, PDO::PARAM_STR); - $sth->bindParam(3, $body, PDO::PARAM_STR); - $sth->bindParam(4, $USERID_DOMAIN, PDO::PARAM_STR); - $sth->execute(); - header("Location: main.php"); - } catch(PDOException $e) { - $message = $LANG['UsersVacation_result_error'] . " " . $e->getMessage(); - } - } - -} -include '../templates/header.tpl'; -include '../templates/users_menu.tpl'; -include '../templates/users_vacation.tpl'; -include '../templates/footer.tpl'; -?>