Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8e07e8f59 |
195
assets/css/custom.css
Normal file
195
assets/css/custom.css
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
|
||||||
|
/* General Body Styles */
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
height: 100vh;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar Styles */
|
||||||
|
.sidebar {
|
||||||
|
width: 260px;
|
||||||
|
background-color: #800020; /* Burgundy */
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar h2 {
|
||||||
|
margin: 0 0 30px 0;
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav li {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
display: block;
|
||||||
|
padding: 12px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav li.active a,
|
||||||
|
.sidebar nav a:hover {
|
||||||
|
background-color: #a00028; /* Darker Burgundy */
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-area {
|
||||||
|
margin-top: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-area a {
|
||||||
|
display: block;
|
||||||
|
padding: 12px 15px;
|
||||||
|
background-color: #600018;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-area a:hover {
|
||||||
|
background-color: #500014;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Content Styles */
|
||||||
|
.main-content {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content header {
|
||||||
|
padding: 20px 40px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content header h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content main {
|
||||||
|
padding: 40px;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dashboard Cards */
|
||||||
|
.cards-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||||
|
transition: transform 0.2s, box-shadow 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h3 {
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #800020; /* Burgundy */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Login Page Specific Styles */
|
||||||
|
.login-body {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 40px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||||
|
text-align: center;
|
||||||
|
max-width: 400px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container p {
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container .form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container input[type="text"],
|
||||||
|
.login-container input[type="password"] {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container button {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
background-color: #800020; /* Burgundy */
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container button:hover {
|
||||||
|
background-color: #a00028; /* Darker Burgundy */
|
||||||
|
}
|
||||||
BIN
assets/pasted-20251012-111458-24ba26de.png
Normal file
BIN
assets/pasted-20251012-111458-24ba26de.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@ -7,11 +7,39 @@ define('DB_PASS', 'e45f2778-db1f-450c-99c6-29efb4601472');
|
|||||||
|
|
||||||
function db() {
|
function db() {
|
||||||
static $pdo;
|
static $pdo;
|
||||||
if (!$pdo) {
|
if ($pdo) {
|
||||||
|
return $pdo;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Connect with DB name
|
||||||
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
]);
|
]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// If database doesn't exist, create it
|
||||||
|
if ($e->getCode() === 1049) { // SQLSTATE[HY000] [1049] Unknown database
|
||||||
|
try {
|
||||||
|
$tempPdo = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASS, [
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
]);
|
||||||
|
$tempPdo->exec('CREATE DATABASE IF NOT EXISTS `'.DB_NAME.'` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
||||||
|
|
||||||
|
// Reconnect with the new database
|
||||||
|
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
|
]);
|
||||||
|
} catch (PDOException $ce) {
|
||||||
|
// If creation fails, die
|
||||||
|
die('Failed to create database: ' . $ce->getMessage());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// For other errors, die
|
||||||
|
die('DB Connection failed: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $pdo;
|
return $pdo;
|
||||||
}
|
}
|
||||||
|
|||||||
43
db/migrate.php
Normal file
43
db/migrate.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
// Drop and recreate table
|
||||||
|
$sql = file_get_contents(__DIR__ . '/migrations/001_create_users_table.sql');
|
||||||
|
$pdo->exec($sql);
|
||||||
|
echo "Table 'users' created successfully.\n";
|
||||||
|
|
||||||
|
// New users
|
||||||
|
$users = [
|
||||||
|
['Admin', 'admin', 'password123', 'Admin'],
|
||||||
|
['Rumaiz', 'rumaiz', 'Rumaiz4556', 'Manager'],
|
||||||
|
['Nadeeni', 'nadeeni', 'Nadz1234', 'Manager'],
|
||||||
|
['Kaveesh', 'kaveesh', 'Kaveesh123', 'Staff'],
|
||||||
|
['Sarani', 'sarani', 'Sarani789', 'Staff'],
|
||||||
|
['Nazeeha', 'nazeeha', 'Nazeeha1234', 'Staff'],
|
||||||
|
['Thiwanka', 'thiwanka', 'Thiwanka567', 'Staff'],
|
||||||
|
['Customer Service', 'customerservice', 'Coho2646', 'Staff'],
|
||||||
|
['Siranjeewan', 'siranjeewan', 'Siranjeewan123', 'Rider'],
|
||||||
|
['Rozan', 'rozan', 'Rozan123', 'Rider'],
|
||||||
|
['Coho Rider', 'cohorider', 'Coho123456', 'Rider'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare(
|
||||||
|
'INSERT INTO users (full_name, username, password, role) VALUES (?, ?, ?, ?)'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$fullName = $user[0];
|
||||||
|
$username = $user[1];
|
||||||
|
$password = password_hash($user[2], PASSWORD_DEFAULT);
|
||||||
|
$role = $user[3];
|
||||||
|
$stmt->execute([$fullName, $username, $password, $role]);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Users inserted successfully.\n";
|
||||||
|
echo "Migration completed successfully.\n";
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Migration failed: " . $e->getMessage() . "\n");
|
||||||
|
}
|
||||||
12
db/migrations/001_create_users_table.sql
Normal file
12
db/migrations/001_create_users_table.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
full_name VARCHAR(255) NOT NULL,
|
||||||
|
username VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
password VARCHAR(255) NOT NULL,
|
||||||
|
role ENUM('Admin', 'Manager', 'Staff', 'Dispatcher', 'Rider', 'Viewer') NOT NULL,
|
||||||
|
is_active BOOLEAN DEFAULT TRUE,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
last_login TIMESTAMP NULL
|
||||||
|
);
|
||||||
50
hubs.php
Normal file
50
hubs.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If user is not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Hubs - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h2>Coho Connect</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Dashboard</a></li>
|
||||||
|
<li><a href="orders.php">Orders</a></li>
|
||||||
|
<li class="active"><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li><a href="staff.php">Staff</a></li>
|
||||||
|
<li><a href="riders.php">Riders</a></li>
|
||||||
|
<li><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Hubs</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Hub management will be implemented here.</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
193
index.php
193
index.php
@ -1,150 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
session_start();
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
// If user is not logged in, redirect to login page
|
||||||
@date_default_timezone_set('UTC');
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>Dashboard - Coho Connect</title>
|
||||||
<?php
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
// Read project preview data from environment
|
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
||||||
?>
|
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<div class="sidebar">
|
||||||
<div class="card">
|
<h2>Coho Connect</h2>
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav>
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<ul>
|
||||||
<span class="sr-only">Loading…</span>
|
<li class="active"><a href="index.php">Dashboard</a></li>
|
||||||
|
<li><a href="orders.php">Orders</a></li>
|
||||||
|
<li><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li><a href="staff.php">Staff</a></li>
|
||||||
|
<li><a href="riders.php">Riders</a></li>
|
||||||
|
<li><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Dashboard</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<div class="cards-container">
|
||||||
|
<div class="card">
|
||||||
|
<h3>Total Orders</h3>
|
||||||
|
<p>0</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>Completed</h3>
|
||||||
|
<p>0</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>Pending</h3>
|
||||||
|
<p>0</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>Riders Online</h3>
|
||||||
|
<p>0</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
</div>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
|
||||||
</footer>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
82
login.php
Normal file
82
login.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
// If user is already logged in, redirect to dashboard
|
||||||
|
if (isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$username = $_POST['username'] ?? '';
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
|
if (empty($username) || empty($password)) {
|
||||||
|
$error_message = 'Please enter both username and password.';
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
|
||||||
|
$stmt->execute([$username]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
// Password is correct, start session
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
$_SESSION['user_username'] = $user['username'];
|
||||||
|
$_SESSION['user_role'] = $user['role'];
|
||||||
|
$_SESSION['user_fullName'] = $user['full_name'];
|
||||||
|
|
||||||
|
// Update last login timestamp
|
||||||
|
$updateStmt = $pdo->prepare('UPDATE users SET last_login = CURRENT_TIMESTAMP WHERE id = ?');
|
||||||
|
$updateStmt->execute([$user['id']]);
|
||||||
|
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error_message = 'Invalid username or password.';
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = 'Database error. Please try again later.';
|
||||||
|
// In a real app, you would log this error instead of showing a generic message.
|
||||||
|
// error_log($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Login - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body class="login-body">
|
||||||
|
<div class="login-container">
|
||||||
|
<h2>Welcome to Coho Connect</h2>
|
||||||
|
<p>Please sign in to continue</p>
|
||||||
|
|
||||||
|
<?php if (!empty($error_message)): ?>
|
||||||
|
<div class="error-message"><?php echo htmlspecialchars($error_message); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="login.php" method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="username">Username</label>
|
||||||
|
<input type="text" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">Password</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit">Sign In</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
logout.php
Normal file
6
logout.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
50
orders.php
Normal file
50
orders.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If user is not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Orders - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h2>Coho Connect</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Dashboard</a></li>
|
||||||
|
<li class="active"><a href="orders.php">Orders</a></li>
|
||||||
|
<li><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li><a href="staff.php">Staff</a></li>
|
||||||
|
<li><a href="riders.php">Riders</a></li>
|
||||||
|
<li><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Orders</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Order management will be implemented here.</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
50
reports.php
Normal file
50
reports.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If user is not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Reports - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h2>Coho Connect</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Dashboard</a></li>
|
||||||
|
<li><a href="orders.php">Orders</a></li>
|
||||||
|
<li><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li><a href="staff.php">Staff</a></li>
|
||||||
|
<li><a href="riders.php">Riders</a></li>
|
||||||
|
<li class="active"><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Reports</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Report generation will be implemented here.</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
50
riders.php
Normal file
50
riders.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If user is not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Riders - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h2>Coho Connect</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Dashboard</a></li>
|
||||||
|
<li><a href="orders.php">Orders</a></li>
|
||||||
|
<li><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li><a href="staff.php">Staff</a></li>
|
||||||
|
<li class="active"><a href="riders.php">Riders</a></li>
|
||||||
|
<li><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Riders</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Rider management will be implemented here.</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
50
staff.php
Normal file
50
staff.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If user is not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_SESSION['user_fullName'] ?? 'User';
|
||||||
|
$userRole = $_SESSION['user_role'] ?? 'Role';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Staff - Coho Connect</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h2>Coho Connect</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Dashboard</a></li>
|
||||||
|
<li><a href="orders.php">Orders</a></li>
|
||||||
|
<li><a href="hubs.php">Hubs</a></li>
|
||||||
|
<li class="active"><a href="staff.php">Staff</a></li>
|
||||||
|
<li><a href="riders.php">Riders</a></li>
|
||||||
|
<li><a href="reports.php">Reports</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="profile-area">
|
||||||
|
<p><?php echo htmlspecialchars($userName); ?></p>
|
||||||
|
<span><?php echo htmlspecialchars($userRole); ?></span>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main-content">
|
||||||
|
<header>
|
||||||
|
<h1>Staff</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Staff management will be implemented here.</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user