|
Server IP : 217.21.85.138 / Your IP : 216.73.216.103 Web Server : LiteSpeed System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u915722082 ( 915722082) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u915722082/public_html/globalmining/../pms/admin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
require_once '../config/config.php';
require_once '../config/db.php';
// If already logged in, redirect to users page
if (isset($_SESSION['admin_id'])) {
header('Location: users.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login - TDS Admin Hub</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="../assets/media/logos/favicon.ico" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700" />
<link href="../assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
<link href="../assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
<style>
body {
background-image: url('../assets/media/auth/bg4.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.login-wrapper {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border-radius: 15px;
box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
}
@media (max-width: 768px) {
.login-wrapper {
background: rgba(255, 255, 255, 0.98);
}
}
.text-primary{
color: white !important;
}
</style>
</head>
<body id="kt_body" class="app-blank">
<script>
var defaultThemeMode = "light";
var themeMode;
if (document.documentElement) {
if (document.documentElement.hasAttribute("data-bs-theme-mode")) {
themeMode = document.documentElement.getAttribute("data-bs-theme-mode");
} else {
if (localStorage.getItem("data-bs-theme") !== null) {
themeMode = localStorage.getItem("data-bs-theme");
} else {
themeMode = defaultThemeMode;
}
}
if (themeMode === "system") {
themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
document.documentElement.setAttribute("data-bs-theme", themeMode);
}
</script>
<div class="d-flex flex-column flex-root" id="kt_app_root">
<div class="d-flex flex-column flex-lg-row flex-column-fluid">
<!-- Left Side - Login Form -->
<div class="d-flex flex-column flex-lg-row-fluid w-lg-50 p-10 order-2 order-lg-1">
<div class="d-flex flex-center flex-column flex-lg-row-fluid">
<div class="w-lg-500px p-10 login-wrapper">
<form class="form w-100" id="kt_sign_in_form" novalidate>
<div class="text-center mb-11">
<!--<img alt="Logo" src="../assets/media/logos/LOGO.png" class="h-60px mb-5" />-->
<h1 class="text-gray-900 fw-bolder mb-3">Sign In</h1>
<div class="text-gray-500 fw-semibold fs-6">Welcome to TDS Admin Hub</div>
</div>
<!-- ✅ Alert Box for AJAX Errors -->
<div id="alertBox"></div>
<!-- Email Field -->
<div class="fv-row mb-8">
<label class="form-label fs-6 fw-bolder text-gray-900">Email</label>
<input class="form-control form-control-lg form-control-solid"
type="email"
name="email"
id="email"
autocomplete="off"
placeholder="Enter your email"
required />
</div>
<!-- Password Field -->
<div class="fv-row mb-3">
<label class="form-label fw-bolder text-gray-900 fs-6 mb-0">Password</label>
<input class="form-control form-control-lg form-control-solid"
type="password"
name="password"
id="password"
autocomplete="off"
placeholder="Enter your password"
required />
</div>
<!-- Forgot Password Link -->
<div class="d-flex flex-stack flex-wrap gap-3 fs-base fw-semibold mb-8">
<div></div>
<a href="forgot-password.php" class="link-primary">Forgot Password?</a>
</div>
<!-- Submit Button -->
<div class="d-grid mb-10">
<button type="submit" id="kt_sign_in_submit" class="btn btn-primary">
<span class="indicator-label">Sign In</span>
<span class="indicator-progress">
Please wait...
<span class="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
</button>
</div>
</form>
</div>
</div>
<!-- Footer Links -->
<div class="w-lg-500px d-flex flex-stack px-10 mx-auto">
<div class="me-10">
<a href="https://thedotstudios.com/" target="_blank" class="text-gray-600 text-hover-primary">About</a>
<a href="https://thedotstudios.com/" target="_blank" class="text-gray-600 text-hover-primary ms-5">Contact</a>
</div>
<div class="d-flex fw-semibold text-primary fs-base gap-5">
<span>© 2024 TheDotStudios</span>
</div>
</div>
</div>
<!-- Right Side - Branding -->
<div class="d-flex flex-lg-row-fluid w-lg-50 bgi-size-cover bgi-position-center order-1 order-lg-2"
style="background-image: url(../assets/media/misc/auth-bg.png)">
<div class="d-flex flex-column flex-center py-7 py-lg-15 px-5 px-md-15 w-100">
<a href="#" class="mb-0 mb-lg-12">
<img alt="Logo" src="../assets/media/logos/LOGO.png" class="h-60px h-lg-75px" />
</a>
<h1 class="d-none d-lg-block text-white fs-2qx fw-bolder text-center mb-7">
Fast, Efficient and Productive
</h1>
<div class="d-none d-lg-block text-white fs-base text-center">
Manage your company efficiently with our comprehensive
<br />admin dashboard. Track users, assign tasks, and
<br />monitor progress all in one place.
</div>
</div>
</div>
</div>
</div>
<!-- Scripts -->
<script src="../assets/plugins/global/plugins.bundle.js"></script>
<script src="../assets/js/scripts.bundle.js"></script>
<script>
// ✅ AJAX Login Form Handler
document.getElementById('kt_sign_in_form').addEventListener('submit', function(e) {
e.preventDefault(); // Prevent default form submission
const submitButton = document.getElementById('kt_sign_in_submit');
const alertBox = document.getElementById('alertBox');
const email = document.getElementById('email').value.trim();
const password = document.getElementById('password').value;
// Clear previous alerts
alertBox.innerHTML = '';
// Validation
if (!email || !password) {
alertBox.innerHTML = `
<div class="alert alert-danger d-flex align-items-center p-5 mb-10">
<i class="ki-duotone ki-shield-cross fs-2hx text-danger me-4">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
</i>
<div class="d-flex flex-column">
<h4 class="mb-1 text-danger">Error</h4>
<span>Please enter both email and password</span>
</div>
</div>`;
return;
}
// Show loading state
submitButton.setAttribute('data-kt-indicator', 'on');
submitButton.disabled = true;
// Create FormData
const formData = new FormData();
formData.append('email', email);
formData.append('password', password);
// Send AJAX request
fetch('login_process.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
submitButton.removeAttribute('data-kt-indicator');
submitButton.disabled = false;
if (data.success) {
alertBox.innerHTML = `
<div class="alert alert-success d-flex align-items-center p-5 mb-10">
<i class="ki-duotone ki-shield-tick fs-2hx text-success me-4">
<span class="path1"></span>
<span class="path2"></span>
</i>
<div class="d-flex flex-column">
<h4 class="mb-1 text-success">Success</h4>
<span>${data.message}</span>
</div>
</div>`;
// ✅ Redirect after 1 second
setTimeout(() => {
window.location.href = data.redirect; // Dynamic redirect based on role
}, 1000);
} else {
// ✅ Show error message
alertBox.innerHTML = `
<div class="alert alert-danger d-flex align-items-center p-5 mb-10">
<i class="ki-duotone ki-shield-cross fs-2hx text-danger me-4">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
</i>
<div class="d-flex flex-column">
<h4 class="mb-1 text-danger">Error</h4>
<span>${data.message}</span>
</div>
</div>`;
}
})
.catch(error => {
submitButton.removeAttribute('data-kt-indicator');
submitButton.disabled = false;
alertBox.innerHTML = `
<div class="alert alert-danger d-flex align-items-center p-5 mb-10">
<i class="ki-duotone ki-shield-cross fs-2hx text-danger me-4">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
</i>
<div class="d-flex flex-column">
<h4 class="mb-1 text-danger">Error</h4>
<span>Connection error. Please try again.</span>
</div>
</div>`;
console.error('Error:', error);
});
});
</script>
</body>
</html>