sadiq
This commit is contained in:
parent
6f72517df1
commit
1c9d48b454
@ -5,6 +5,11 @@ include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
|
||||
<main>
|
||||
<div class="container mt-4">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Home
|
||||
</a>
|
||||
</div>
|
||||
<section class="hero" style="min-height: 40vh; padding: 100px 0;">
|
||||
<div class="container">
|
||||
<h1>About <span class="text-gold">Us</span></h1>
|
||||
|
||||
@ -186,6 +186,18 @@ td {
|
||||
.btn-danger { background: var(--danger); color: white; }
|
||||
.btn-success { background: var(--success); color: white; }
|
||||
|
||||
.btn-back {
|
||||
background: transparent;
|
||||
border: 1px solid var(--sidebar-text);
|
||||
color: var(--text);
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.btn-back:hover {
|
||||
background: rgba(0,0,0,0.05);
|
||||
border-color: var(--text);
|
||||
}
|
||||
|
||||
/* Modal (CSS Only) */
|
||||
.modal {
|
||||
display: none;
|
||||
|
||||
@ -7,7 +7,7 @@ function isAdmin() {
|
||||
|
||||
function requireAdmin() {
|
||||
if (!isAdmin()) {
|
||||
header('Location: index.php');
|
||||
header('Location: ../login.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,18 @@
|
||||
<div class="top-bar">
|
||||
<div class="page-title">
|
||||
<div class="page-title" style="display: flex; align-items: center;">
|
||||
<?php
|
||||
$current_page = basename($_SERVER['PHP_SELF']);
|
||||
if ($current_page !== 'dashboard.php'): ?>
|
||||
<a href="dashboard.php" class="btn btn-back">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
|
||||
Back
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="../index.php" class="btn btn-back">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
|
||||
Website
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<h2 style="font-size: 1.5rem;"><?php echo $page_title ?? 'Dashboard'; ?></h2>
|
||||
</div>
|
||||
<div class="user-profile" style="display: flex; align-items: center; gap: 15px;">
|
||||
|
||||
103
admin/index.php
103
admin/index.php
@ -1,102 +1,3 @@
|
||||
<?php
|
||||
require_once '../db/config.php';
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'admin') {
|
||||
header('Location: dashboard.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$error = '';
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$email = $_POST['email'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
$stmt = db()->prepare("SELECT * FROM users WHERE email = ? AND role = 'admin'");
|
||||
$stmt->execute([$email]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$_SESSION['user_id'] = $user['id'];
|
||||
$_SESSION['user_name'] = $user['name'];
|
||||
$_SESSION['user_role'] = $user['role'];
|
||||
header('Location: dashboard.php');
|
||||
exit();
|
||||
} else {
|
||||
$error = 'Invalid admin credentials.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Login - Car Sales Afghanistan</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<style>
|
||||
body {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background: #0f172a;
|
||||
}
|
||||
.login-card {
|
||||
background: #1f2937;
|
||||
padding: 2.5rem;
|
||||
border-radius: 16px;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
}
|
||||
.login-card h2 { margin-bottom: 1.5rem; text-align: center; font-size: 1.8rem; }
|
||||
.form-group { margin-bottom: 1.2rem; }
|
||||
.form-group label { display: block; margin-bottom: 0.5rem; color: #9ca3af; }
|
||||
.form-control {
|
||||
width: 100%;
|
||||
padding: 0.8rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #374151;
|
||||
background: #111827;
|
||||
color: white;
|
||||
outline: none;
|
||||
}
|
||||
.form-control:focus { border-color: var(--accent); }
|
||||
.btn-login {
|
||||
width: 100%;
|
||||
padding: 0.8rem;
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.btn-login:hover { background: #1d4ed8; transform: translateY(-2px); }
|
||||
.error { color: #ef4444; margin-bottom: 1rem; text-align: center; font-size: 0.9rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<h2>Admin Portal</h2>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?php echo $error; ?></div>
|
||||
<?php endif; ?>
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label>Email Address</label>
|
||||
<input type="email" name="email" class="form-control" required placeholder="admin@gmail.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" class="form-control" required placeholder="••••••••">
|
||||
</div>
|
||||
<button type="submit" class="btn-login">Secure Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
header('Location: ../login.php');
|
||||
exit();
|
||||
|
||||
@ -24,6 +24,11 @@ include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
|
||||
<main>
|
||||
<div class="container mt-4">
|
||||
<a href="cars.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Cars
|
||||
</a>
|
||||
</div>
|
||||
<section class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
|
||||
5
cars.php
5
cars.php
@ -15,6 +15,11 @@ include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
|
||||
<main>
|
||||
<div class="container mt-4">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Home
|
||||
</a>
|
||||
</div>
|
||||
<section class="hero" style="min-height: 30vh; padding: 60px 0;">
|
||||
<div class="container">
|
||||
<h1>Browse <span class="text-gold">Our Collection</span></h1>
|
||||
|
||||
@ -34,6 +34,11 @@ include 'includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="container mt-4">
|
||||
<div style="margin-bottom: 20px;">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Home
|
||||
</a>
|
||||
</div>
|
||||
<div class="row justify-between align-center">
|
||||
<div class="col-6">
|
||||
<h1 class="section-title">Get in Touch</h1>
|
||||
|
||||
@ -39,7 +39,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
include 'includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="container mt-4" style="min-height: 70vh; display: flex; align-items: center; justify-content: center;">
|
||||
<main class="container mt-4" style="min-height: 70vh; display: flex; align-items: center; justify-content: center; flex-direction: column;">
|
||||
<div style="width: 100%; max-width: 450px; margin-bottom: 20px;">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Home
|
||||
</a>
|
||||
</div>
|
||||
<div style="width: 100%; max-width: 450px;">
|
||||
<div class="glass-card">
|
||||
<h2 class="text-center mb-4">Welcome Back</h2>
|
||||
|
||||
@ -40,7 +40,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
include 'includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="container mt-4" style="min-height: 70vh; display: flex; align-items: center; justify-content: center;">
|
||||
<main class="container mt-4" style="min-height: 70vh; display: flex; align-items: center; justify-content: center; flex-direction: column;">
|
||||
<div style="width: 100%; max-width: 450px; margin-bottom: 20px;">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Home
|
||||
</a>
|
||||
</div>
|
||||
<div style="width: 100%; max-width: 450px;">
|
||||
<div class="glass-card">
|
||||
<h2 class="text-center mb-4">Create Account</h2>
|
||||
|
||||
@ -64,6 +64,11 @@ include 'includes/header.php';
|
||||
|
||||
<!-- Main Content -->
|
||||
<div style="flex: 3; min-width: 300px;">
|
||||
<div style="margin-bottom: 20px;">
|
||||
<a href="index.php" style="display: inline-flex; align-items: center; gap: 8px; color: var(--accent-gold); text-decoration: none; font-weight: 500;">
|
||||
<span>←</span> Back to Website
|
||||
</a>
|
||||
</div>
|
||||
<div class="glass-card mb-4">
|
||||
<h2>Welcome to your Dashboard</h2>
|
||||
<p style="color: var(--text-muted);">Manage your bookings and view your saved cars.</p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user