39311-vm/login.php
2026-03-25 13:56:27 +00:00

93 lines
3.9 KiB
PHP

<?php
session_start();
// Logout logic
if (isset($_GET['logout'])) {
session_destroy();
header('Location: login.php');
exit;
}
// Simple logic for any login
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'] ?? '';
$password = $_POST['password'] ?? '';
if (empty($email) || empty($password)) {
$error = 'يرجى إدخال البريد الإلكتروني وكلمة المرور.';
} else {
// Any login is accepted as requested
$_SESSION['user'] = [
'name' => 'مسؤول الموارد البشرية',
'email' => $email
];
header('Location: index.php');
exit;
}
}
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية';
?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>تسجيل الدخول - <?php echo htmlspecialchars($project_name); ?></title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<style>
body { background-color: #f0f2f5; }
.login-card { border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: none; }
.login-header { text-align: center; margin-bottom: 30px; }
.form-control { border-radius: 10px; padding: 12px; }
</style>
</head>
<body class="fade-in">
<div class="container">
<div class="row justify-content-center align-items-center vh-100">
<div class="col-md-5 col-lg-4">
<div class="card login-card p-4 p-md-5">
<div class="login-header">
<div class="mb-3">
<i class="fas fa-users-cog fa-4x text-primary"></i>
</div>
<h2 class="fw-bold h4">تسجيل الدخول</h2>
<p class="text-muted small">مرحباً بك مجدداً في لوحة التحكم.</p>
</div>
<?php if ($error): ?>
<div class="alert alert-danger py-2 small"><?php echo $error; ?></div>
<?php endif; ?>
<form action="login.php" method="POST" class="needs-validation" novalidate>
<div class="mb-3">
<label class="form-label small fw-bold">البريد الإلكتروني</label>
<input type="email" name="email" class="form-control" placeholder="admin@example.com" required>
</div>
<div class="mb-4">
<label class="form-label small fw-bold">كلمة المرور</label>
<input type="password" name="password" class="form-control" placeholder="••••••••" required>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary fw-bold py-2">دخول النظام</button>
</div>
<div class="mt-4 text-center">
<small class="text-muted">ملاحظة: يمكنك إدخال أي بريد وكلمة مرور للتجربة.</small>
</div>
</form>
</div>
<div class="mt-4 text-center">
<small class="text-muted">&copy; <?php echo date('Y'); ?> <?php echo htmlspecialchars($project_name); ?></small>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>