Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../includes/header.php';
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$name = $_POST['name'];
|
|
||||||
$description = $_POST['description'];
|
|
||||||
$price = $_POST['price'];
|
|
||||||
$duration_days = $_POST['duration_days'];
|
|
||||||
|
|
||||||
if (empty($name) || empty($description) || empty($price) || empty($duration_days)) {
|
|
||||||
$message = '<div class="alert alert-danger">All fields are required.</div>';
|
|
||||||
} else {
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO services (name, description, price, duration_days) VALUES (?, ?, ?, ?)");
|
|
||||||
if ($stmt->execute([$name, $description, $price, $duration_days])) {
|
|
||||||
header('Location: services.php?success=added');
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$message = '<div class="alert alert-danger">Failed to add service.</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Add New Service</h1>
|
|
||||||
<?php echo $message; ?>
|
|
||||||
<form action="add_service.php" method="post">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="name" class="form-label">Service Name</label>
|
|
||||||
<input type="text" class="form-control" id="name" name="name" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="description" class="form-label">Description</label>
|
|
||||||
<textarea class="form-control" id="description" name="description" rows="3" required></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="price" class="form-label">Price</label>
|
|
||||||
<input type="number" step="0.01" class="form-control" id="price" name="price" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="duration_days" class="form-label">Duration (Days)</label>
|
|
||||||
<input type="number" class="form-control" id="duration_days" name="duration_days" required>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Add Service</button>
|
|
||||||
<a href="services.php" class="btn btn-secondary">Cancel</a>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$service_id = $_GET['id'] ?? null;
|
|
||||||
|
|
||||||
if ($service_id) {
|
|
||||||
$stmt = $pdo->prepare("DELETE FROM services WHERE id = ?");
|
|
||||||
if ($stmt->execute([$service_id])) {
|
|
||||||
header('Location: services.php?success=deleted');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: services.php?error=delete_failed');
|
|
||||||
exit;
|
|
||||||
?>
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../includes/header.php';
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
$service_id = $_GET['id'] ?? null;
|
|
||||||
|
|
||||||
if (!$service_id) {
|
|
||||||
header('Location: services.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM services WHERE id = ?");
|
|
||||||
$stmt->execute([$service_id]);
|
|
||||||
$service = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$service) {
|
|
||||||
header('Location: services.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$name = $_POST['name'];
|
|
||||||
$description = $_POST['description'];
|
|
||||||
$price = $_POST['price'];
|
|
||||||
$duration_days = $_POST['duration_days'];
|
|
||||||
|
|
||||||
if (empty($name) || empty($description) || empty($price) || empty($duration_days)) {
|
|
||||||
$message = '<div class="alert alert-danger">All fields are required.</div>';
|
|
||||||
} else {
|
|
||||||
$stmt = $pdo->prepare("UPDATE services SET name = ?, description = ?, price = ?, duration_days = ? WHERE id = ?");
|
|
||||||
if ($stmt->execute([$name, $description, $price, $duration_days, $service_id])) {
|
|
||||||
header('Location: services.php?success=updated');
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$message = '<div class="alert alert-danger">Failed to update service.</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Edit Service</h1>
|
|
||||||
<?php echo $message; ?>
|
|
||||||
<form action="edit_service.php?id=<?php echo $service['id']; ?>" method="post">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="name" class="form-label">Service Name</label>
|
|
||||||
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($service['name']); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="description" class="form-label">Description</label>
|
|
||||||
<textarea class="form-control" id="description" name="description" rows="3" required><?php echo htmlspecialchars($service['description']); ?></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="price" class="form-label">Price</label>
|
|
||||||
<input type="number" step="0.01" class="form-control" id="price" name="price" value="<?php echo htmlspecialchars($service['price']); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="duration_days" class="form-label">Duration (Days)</label>
|
|
||||||
<input type="number" class="form-control" id="duration_days" name="duration_days" value="<?php echo htmlspecialchars($service['duration_days']); ?>" required>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Update Service</button>
|
|
||||||
<a href="services.php" class="btn btn-secondary">Cancel</a>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../includes/header.php';
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
// Redirect to the dashboard or show an error message
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Admin Panel</h1>
|
|
||||||
<p>Welcome to the admin panel. Here you can manage users and services.</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="users.php">Manage Users</a></li>
|
|
||||||
<li><a href="services.php">Manage Services</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../includes/header.php';
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch all services
|
|
||||||
$stmt = $pdo->query("SELECT id, name, description, price, duration_days FROM services ORDER BY id DESC");
|
|
||||||
$services = $stmt->fetchAll();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Service Management</h1>
|
|
||||||
<p>This page allows you to manage the services offered to users.</p>
|
|
||||||
<a href="add_service.php" class="btn btn-primary mb-3">Add New Service</a>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Price</th>
|
|
||||||
<th>Duration (Days)</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($services as $service): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($service['id']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($service['name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($service['description']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($service['price']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($service['duration_days']); ?></td>
|
|
||||||
<td>
|
|
||||||
<a href="edit_service.php?id=<?php echo $service['id']; ?>" class="btn btn-sm btn-info">Edit</a>
|
|
||||||
<a href="delete_service.php?id=<?php echo $service['id']; ?>" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this service?');">Delete</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../includes/header.php';
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: /login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if (!$user || $user['role'] !== 'admin') {
|
|
||||||
header('Location: /dashboard.php?error=unauthorized');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch all users
|
|
||||||
$stmt = $pdo->query("SELECT id, name, email, role, created_at FROM users ORDER BY created_at DESC");
|
|
||||||
$users = $stmt->fetchAll();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">User Management</h1>
|
|
||||||
<p>This page lists all the users in the database.</p>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Email</th>
|
|
||||||
<th>Role</th>
|
|
||||||
<th>Registered On</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($users as $user_row): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($user_row['id']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($user_row['name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($user_row['email']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($user_row['role']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($user_row['created_at']); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
|
||||||
@ -1,166 +0,0 @@
|
|||||||
/* General Body Styles */
|
|
||||||
body {
|
|
||||||
font-family: 'Roboto', sans-serif;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Typography */
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
font-family: 'Poppins', sans-serif;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Header & Navbar */
|
|
||||||
.navbar {
|
|
||||||
transition: background-color 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
font-family: 'Poppins', sans-serif;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link {
|
|
||||||
font-weight: 500;
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hero Section */
|
|
||||||
.hero-section {
|
|
||||||
background: linear-gradient(135deg, #007BFF, #0056b3);
|
|
||||||
color: white;
|
|
||||||
padding: 100px 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section h1 {
|
|
||||||
font-size: 3.5rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section .lead {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #fff;
|
|
||||||
color: #007BFF;
|
|
||||||
font-weight: 700;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 50px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
border-color: #f0f0f0;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sections */
|
|
||||||
.section {
|
|
||||||
padding: 80px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 4rem;
|
|
||||||
font-size: 2.5rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Segment Cards */
|
|
||||||
.segment-card {
|
|
||||||
border: none;
|
|
||||||
border-radius: 0.75rem;
|
|
||||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
|
|
||||||
transition: transform 0.3s, box-shadow 0.3s;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.segment-card:hover {
|
|
||||||
transform: translateY(-10px);
|
|
||||||
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.segment-card .card-body {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pricing/Plans Section */
|
|
||||||
.pricing-card {
|
|
||||||
border-radius: 0.75rem;
|
|
||||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
|
|
||||||
transition: transform 0.3s, box-shadow 0.3s;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card:hover {
|
|
||||||
transform: translateY(-10px);
|
|
||||||
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card .card-header {
|
|
||||||
background: transparent;
|
|
||||||
border-bottom: none;
|
|
||||||
padding: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card .price {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card .price .period {
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 400;
|
|
||||||
color: #6c757d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card .btn {
|
|
||||||
border-radius: 50px;
|
|
||||||
font-weight: 700;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card.featured {
|
|
||||||
border: 2px solid #007BFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pricing-card.featured .btn-primary {
|
|
||||||
background-color: #007BFF;
|
|
||||||
border-color: #007BFF;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.pricing-card.featured .btn-primary:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
border-color: #0056b3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Footer */
|
|
||||||
.footer {
|
|
||||||
background-color: #343a40;
|
|
||||||
color: #f8f9fa;
|
|
||||||
padding: 40px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a {
|
|
||||||
color: #f8f9fa;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a:hover {
|
|
||||||
color: #007BFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.social-icons a {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
margin: 0 0.5rem;
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
|
|
||||||
// Navbar transparency scroll effect
|
|
||||||
const navbar = document.querySelector('.navbar');
|
|
||||||
if (navbar) {
|
|
||||||
function handleScroll() {
|
|
||||||
if (window.scrollY > 50) {
|
|
||||||
navbar.classList.add('bg-dark');
|
|
||||||
} else {
|
|
||||||
navbar.classList.remove('bg-dark');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial check
|
|
||||||
handleScroll();
|
|
||||||
|
|
||||||
// Listen for scroll events
|
|
||||||
window.addEventListener('scroll', handleScroll);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smooth scrolling for anchor links
|
|
||||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
|
||||||
anchor.addEventListener('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const targetId = this.getAttribute('href');
|
|
||||||
const targetElement = document.querySelector(targetId);
|
|
||||||
|
|
||||||
if (targetElement) {
|
|
||||||
targetElement.scrollIntoView({
|
|
||||||
behavior: 'smooth'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
if (isset($_GET['user_service_id'])) {
|
|
||||||
$user_service_id = $_GET['user_service_id'];
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
// Verify the user owns this subscription before cancelling
|
|
||||||
$stmt = $pdo->prepare("UPDATE user_services SET status = 'cancelled' WHERE id = ? AND user_id = ?");
|
|
||||||
$stmt->execute([$user_service_id, $user_id]);
|
|
||||||
|
|
||||||
if ($stmt->rowCount() > 0) {
|
|
||||||
$_SESSION['message'] = 'Subscription cancelled successfully.';
|
|
||||||
} else {
|
|
||||||
$_SESSION['error'] = 'Could not cancel subscription. It might have been already cancelled or you do not have permission to perform this action.';
|
|
||||||
}
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$_SESSION['error'] = 'Database error: ' . $e->getMessage();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_SESSION['error'] = 'Invalid request.';
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: dashboard.php');
|
|
||||||
exit;
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'includes/header.php';
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: login.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
$p = db()->prepare('SELECT s.name, s.description FROM services s JOIN user_services us ON s.id = us.service_id WHERE us.user_id = ?');
|
|
||||||
$p->execute([$user_id]);
|
|
||||||
$services = $p->fetchAll();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Dashboard</h1>
|
|
||||||
<p class="lead">Welcome to your dashboard. Here are the services you are subscribed to:</p>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<?php if (empty($services)): ?>
|
|
||||||
<div class="col-12">
|
|
||||||
<p>You are not subscribed to any services yet.</p>
|
|
||||||
</div>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php foreach ($services as $service): ?>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card mb-4">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title"><?php echo htmlspecialchars($service['name']); ?></h5>
|
|
||||||
<p class="card-text"><?php echo htmlspecialchars($service['description']); ?></p>
|
|
||||||
<a href="services/<?php echo strtolower(str_replace(' ', '', $service['name'])); ?>.php" class="btn btn-primary">Go to service</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../config.php';
|
|
||||||
|
|
||||||
function migrate_001_create_users_table() {
|
|
||||||
$pdo = db();
|
|
||||||
try {
|
|
||||||
$sql = '
|
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
name VARCHAR(255) NOT NULL,
|
|
||||||
email VARCHAR(255) NOT NULL UNIQUE,
|
|
||||||
password_hash VARCHAR(255) NOT NULL,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
';
|
|
||||||
$pdo->exec($sql);
|
|
||||||
echo "Migration 001: Users table created successfully." . PHP_EOL;
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Migration 001 failed: " . $e->getMessage() . PHP_EOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Self-invocation check
|
|
||||||
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
|
||||||
migrate_001_create_users_table();
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../../db/config.php';
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
$sql = "
|
|
||||||
CREATE TABLE IF NOT EXISTS services (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
name VARCHAR(255) NOT NULL,
|
|
||||||
description TEXT,
|
|
||||||
price DECIMAL(10, 2) NOT NULL,
|
|
||||||
billing_cycle ENUM('monthly', 'yearly') NOT NULL,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
";
|
|
||||||
$pdo->exec($sql);
|
|
||||||
echo "Table 'services' created successfully." . PHP_EOL;
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Could not create table 'services': " . $e->getMessage());
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../../db/config.php';
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
$sql = "
|
|
||||||
CREATE TABLE IF NOT EXISTS user_services (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
user_id INT NOT NULL,
|
|
||||||
service_id INT NOT NULL,
|
|
||||||
status ENUM('active', 'cancelled', 'expired') NOT NULL DEFAULT 'active',
|
|
||||||
start_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
end_date TIMESTAMP NULL,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
";
|
|
||||||
$pdo->exec($sql);
|
|
||||||
echo "Table 'user_services' created successfully." . PHP_EOL;
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Could not create table 'user_services': " . $e->getMessage());
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/../../db/config.php';
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
|
|
||||||
$services = [
|
|
||||||
[
|
|
||||||
'name' => 'Basic Plan',
|
|
||||||
'description' => 'Access to basic features.',
|
|
||||||
'price' => 9.99,
|
|
||||||
'billing_cycle' => 'monthly'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'Pro Plan',
|
|
||||||
'description' => 'Access to all features and priority support.',
|
|
||||||
'price' => 29.99,
|
|
||||||
'billing_cycle' => 'monthly'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'Annual Basic Plan',
|
|
||||||
'description' => 'One year of the Basic Plan.',
|
|
||||||
'price' => 99.99,
|
|
||||||
'billing_cycle' => 'yearly'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'Annual Pro Plan',
|
|
||||||
'description' => 'One year of the Pro Plan.',
|
|
||||||
'price' => 299.99,
|
|
||||||
'billing_cycle' => 'yearly'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$sql = "INSERT INTO services (name, description, price, billing_cycle) VALUES (:name, :description, :price, :billing_cycle)";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($services as $service) {
|
|
||||||
$stmt->execute($service);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Services seeded successfully." . PHP_EOL;
|
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Could not seed services: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../config.php';
|
|
||||||
|
|
||||||
function migrate_005_add_role_to_users_table() {
|
|
||||||
$pdo = db();
|
|
||||||
try {
|
|
||||||
$sql = '
|
|
||||||
ALTER TABLE users
|
|
||||||
ADD COLUMN role VARCHAR(50) NOT NULL DEFAULT \'user\';
|
|
||||||
';
|
|
||||||
$pdo->exec($sql);
|
|
||||||
echo "Migration 005: Added role column to users table successfully." . PHP_EOL;
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Migration 005 failed: " . $e->getMessage() . PHP_EOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Self-invocation check
|
|
||||||
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
|
||||||
migrate_005_add_role_to_users_table();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
</main>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<footer class="footer">
|
|
||||||
<div class="container text-center">
|
|
||||||
<div class="social-icons mb-3">
|
|
||||||
<a href="#"><i class="bi bi-twitter-x"></i></a>
|
|
||||||
<a href="#"><i class="bi bi-facebook"></i></a>
|
|
||||||
<a href="#"><i class="bi bi-linkedin"></i></a>
|
|
||||||
</div>
|
|
||||||
<p>© <?php echo date("Y"); ?> <?php echo htmlspecialchars($project_name); ?>. All Rights Reserved.</p>
|
|
||||||
<p>
|
|
||||||
<a href="#">About</a> ·
|
|
||||||
<a href="#">Contact</a> ·
|
|
||||||
<a href="#">Privacy Policy</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<!-- Bootstrap JS Bundle -->
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Custom JS -->
|
|
||||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
<?php session_start(); ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<!-- Bootstrap CSS -->
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
|
|
||||||
<!-- Bootstrap Icons -->
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
||||||
|
|
||||||
<!-- Google Fonts -->
|
|
||||||
<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=Poppins:wght@400;700&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
|
||||||
|
|
||||||
<!-- Custom CSS -->
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$project_name = getenv("PROJECT_NAME") ?: "Telecommunications Platform";
|
|
||||||
$project_description = getenv("PROJECT_DESCRIPTION") ?: "A robust platform for all your telecommunication needs.";
|
|
||||||
$project_image_url = getenv("PROJECT_IMAGE_URL") ?: "assets/images/pexels-photo-267350.jpeg";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<title><?php echo htmlspecialchars($project_name); ?></title>
|
|
||||||
<meta name="description" content="<?php echo htmlspecialchars($project_description); ?>">
|
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta property="og:title" content="<?php echo htmlspecialchars($project_name); ?>">
|
|
||||||
<meta property="og:description" content="<?php echo htmlspecialchars($project_description); ?>">
|
|
||||||
<meta property="og:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
|
|
||||||
|
|
||||||
<!-- Twitter -->
|
|
||||||
<meta property="twitter:card" content="summary_large_image">
|
|
||||||
<meta property="twitter:title" content="<?php echo htmlspecialchars($project_name); ?>">
|
|
||||||
<meta property="twitter:description" content="<?php echo htmlspecialchars($project_description); ?>">
|
|
||||||
<meta property="twitter:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- Header -->
|
|
||||||
<header>
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
|
|
||||||
<div class="container">
|
|
||||||
<a class="navbar-brand" href="index.php">
|
|
||||||
<i class="bi bi-broadcast"></i>
|
|
||||||
<?php echo htmlspecialchars($project_name); ?>
|
|
||||||
</a>
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
|
||||||
<ul class="navbar-nav ms-auto">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="index.php#home">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="index.php#plans">Plans</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="index.php#business">Business</a>
|
|
||||||
</li>
|
|
||||||
<?php if (isset($_SESSION['user_id'])): ?>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="dashboard.php">Dashboard</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="subscribe.php">Subscribe</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
||||||
Hi, <?php echo htmlspecialchars($_SESSION['user_name']); ?>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
||||||
<?php
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT role FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
if ($user && $user['role'] === 'admin'): ?>
|
|
||||||
<li><a class="dropdown-item" href="admin/index.php">Admin</a></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
|
||||||
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<?php else: ?>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="login.php">Login</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="register.php">Register</a>
|
|
||||||
</li>
|
|
||||||
<?php endif; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
|
||||||
271
index.php
271
index.php
@ -1,123 +1,150 @@
|
|||||||
<?php require_once 'includes/header.php'; ?>
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
@ini_set('display_errors', '1');
|
||||||
|
@error_reporting(E_ALL);
|
||||||
|
@date_default_timezone_set('UTC');
|
||||||
|
|
||||||
<!-- Hero Section -->
|
$phpVersion = PHP_VERSION;
|
||||||
<section id="home" class="hero-section">
|
$now = date('Y-m-d H:i:s');
|
||||||
<div class="container">
|
?>
|
||||||
<h1>Connect Your World</h1>
|
<!doctype html>
|
||||||
<p class="lead">Reliable, fast, and seamless communication solutions for everyone.</p>
|
<html lang="en">
|
||||||
<a href="#plans" class="btn btn-primary">See Our Plans</a>
|
<head>
|
||||||
</div>
|
<meta charset="utf-8" />
|
||||||
</section>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>New Style</title>
|
||||||
<!-- Customer Segments Section -->
|
<?php
|
||||||
<section id="business" class="section bg-light">
|
// Read project preview data from environment
|
||||||
<div class="container">
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||||
<h2 class="section-title">Built for Everyone</h2>
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
<div class="row g-4">
|
?>
|
||||||
<!-- Residential -->
|
<?php if ($projectDescription): ?>
|
||||||
<div class="col-lg-4 d-flex align-items-stretch">
|
<!-- Meta description -->
|
||||||
<div class="card segment-card text-center">
|
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||||
<div class="card-body">
|
<!-- Open Graph meta tags -->
|
||||||
<i class="bi bi-house-heart-fill fs-1 text-primary mb-3"></i>
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<h3 class="card-title">Residential</h3>
|
<!-- Twitter meta tags -->
|
||||||
<p class="card-text">High-speed internet and streaming for your home. Enjoy uninterrupted connectivity for work, school, and entertainment.</p>
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<a href="#" class="btn btn-outline-primary mt-auto">Learn More</a>
|
<?php endif; ?>
|
||||||
</div>
|
<?php if ($projectImageUrl): ?>
|
||||||
</div>
|
<!-- Open Graph image -->
|
||||||
</div>
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<!-- Small Business -->
|
<!-- Twitter image -->
|
||||||
<div class="col-lg-4 d-flex align-items-stretch">
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<div class="card segment-card text-center">
|
<?php endif; ?>
|
||||||
<div class="card-body">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<i class="bi bi-briefcase-fill fs-1 text-primary mb-3"></i>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<h3 class="card-title">Small Business</h3>
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
<p class="card-text">Affordable and scalable solutions to power your business growth. Keep your team connected and productive.</p>
|
<style>
|
||||||
<a href="#" class="btn btn-outline-primary mt-auto">Discover Solutions</a>
|
:root {
|
||||||
</div>
|
--bg-color-start: #6a11cb;
|
||||||
</div>
|
--bg-color-end: #2575fc;
|
||||||
</div>
|
--text-color: #ffffff;
|
||||||
<!-- Enterprise -->
|
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||||
<div class="col-lg-4 d-flex align-items-stretch">
|
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||||
<div class="card segment-card text-center">
|
}
|
||||||
<div class="card-body">
|
body {
|
||||||
<i class="bi bi-building-fill fs-1 text-primary mb-3"></i>
|
margin: 0;
|
||||||
<h3 class="card-title">Enterprise</h3>
|
font-family: 'Inter', sans-serif;
|
||||||
<p class="card-text">Dedicated fiber, cloud services, and robust infrastructure for large-scale operations. Mission-critical reliability.</p>
|
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||||
<a href="#" class="btn btn-outline-primary mt-auto">Explore Services</a>
|
color: var(--text-color);
|
||||||
</div>
|
display: flex;
|
||||||
</div>
|
justify-content: center;
|
||||||
</div>
|
align-items: center;
|
||||||
</div>
|
min-height: 100vh;
|
||||||
</div>
|
text-align: center;
|
||||||
</section>
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
<!-- Plans Section -->
|
}
|
||||||
<section id="plans" class="section">
|
body::before {
|
||||||
<div class="container">
|
content: '';
|
||||||
<h2 class="section-title">Our Plans</h2>
|
position: absolute;
|
||||||
<div class="row justify-content-center g-4">
|
top: 0;
|
||||||
<!-- Basic Plan -->
|
left: 0;
|
||||||
<div class="col-lg-4">
|
width: 100%;
|
||||||
<div class="card pricing-card h-100">
|
height: 100%;
|
||||||
<div class="card-header text-center">
|
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>');
|
||||||
<h3>Starter</h3>
|
animation: bg-pan 20s linear infinite;
|
||||||
</div>
|
z-index: -1;
|
||||||
<div class="card-body text-center">
|
}
|
||||||
<p class="price">$29.99<span class="period">/mo</span></p>
|
@keyframes bg-pan {
|
||||||
<ul class="list-unstyled">
|
0% { background-position: 0% 0%; }
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> 100 Mbps Download</li>
|
100% { background-position: 100% 100%; }
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> Unlimited Data</li>
|
}
|
||||||
<li><i class="bi bi-x-circle"></i> HD Streaming</li>
|
main {
|
||||||
<li><i class="bi bi-x-circle"></i> 24/7 Priority Support</li>
|
padding: 2rem;
|
||||||
</ul>
|
}
|
||||||
</div>
|
.card {
|
||||||
<div class="card-footer text-center">
|
background: var(--card-bg-color);
|
||||||
<a href="#" class="btn btn-outline-primary">Sign Up</a>
|
border: 1px solid var(--card-border-color);
|
||||||
</div>
|
border-radius: 16px;
|
||||||
</div>
|
padding: 2rem;
|
||||||
</div>
|
backdrop-filter: blur(20px);
|
||||||
<!-- Pro Plan (Featured) -->
|
-webkit-backdrop-filter: blur(20px);
|
||||||
<div class="col-lg-4">
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||||
<div class="card pricing-card featured h-100">
|
}
|
||||||
<div class="card-header text-center">
|
.loader {
|
||||||
<h3>Pro Fiber</h3>
|
margin: 1.25rem auto 1.25rem;
|
||||||
</div>
|
width: 48px;
|
||||||
<div class="card-body text-center">
|
height: 48px;
|
||||||
<p class="price">$59.99<span class="period">/mo</span></p>
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||||
<ul class="list-unstyled">
|
border-top-color: #fff;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> 1 Gbps Symmetric</li>
|
border-radius: 50%;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> Unlimited Data</li>
|
animation: spin 1s linear infinite;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> 4K Streaming</li>
|
}
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> 24/7 Priority Support</li>
|
@keyframes spin {
|
||||||
</ul>
|
from { transform: rotate(0deg); }
|
||||||
</div>
|
to { transform: rotate(360deg); }
|
||||||
<div class="card-footer text-center">
|
}
|
||||||
<a href="#" class="btn btn-primary">Sign Up</a>
|
.hint {
|
||||||
</div>
|
opacity: 0.9;
|
||||||
</div>
|
}
|
||||||
</div>
|
.sr-only {
|
||||||
<!-- Business Plan -->
|
position: absolute;
|
||||||
<div class="col-lg-4">
|
width: 1px; height: 1px;
|
||||||
<div class="card pricing-card h-100">
|
padding: 0; margin: -1px;
|
||||||
<div class="card-header text-center">
|
overflow: hidden;
|
||||||
<h3>Business Ultimate</h3>
|
clip: rect(0, 0, 0, 0);
|
||||||
</div>
|
white-space: nowrap; border: 0;
|
||||||
<div class="card-body text-center">
|
}
|
||||||
<p class="price">$99.99<span class="period">/mo</span></p>
|
h1 {
|
||||||
<ul class="list-unstyled">
|
font-size: 3rem;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> 2 Gbps Symmetric</li>
|
font-weight: 700;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> Unlimited Data</li>
|
margin: 0 0 1rem;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> Dedicated Account Rep</li>
|
letter-spacing: -1px;
|
||||||
<li><i class="bi bi-check-circle-fill text-primary"></i> SLA Guarantee</li>
|
}
|
||||||
</ul>
|
p {
|
||||||
</div>
|
margin: 0.5rem 0;
|
||||||
<div class="card-footer text-center">
|
font-size: 1.1rem;
|
||||||
<a href="#" class="btn btn-outline-primary">Sign Up</a>
|
}
|
||||||
</div>
|
code {
|
||||||
</div>
|
background: rgba(0,0,0,0.2);
|
||||||
</div>
|
padding: 2px 6px;
|
||||||
</div>
|
border-radius: 4px;
|
||||||
</div>
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||||
</section>
|
}
|
||||||
|
footer {
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
position: absolute;
|
||||||
|
bottom: 1rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<div class="card">
|
||||||
|
<h1>Analyzing your requirements and generating your website…</h1>
|
||||||
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
|
<span class="sr-only">Loading…</span>
|
||||||
|
</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>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
88
login.php
88
login.php
@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$errors = [];
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$password = $_POST['password'];
|
|
||||||
|
|
||||||
if (empty($email)) {
|
|
||||||
$errors[] = 'Email is required';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($password)) {
|
|
||||||
$errors[] = 'Password is required';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($errors)) {
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
|
||||||
$stmt->execute([$email]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
if ($user) {
|
|
||||||
echo "User found. ";
|
|
||||||
if (password_verify($password, $user['password_hash'])) {
|
|
||||||
$_SESSION['user_id'] = $user['id'];
|
|
||||||
$_SESSION['user_name'] = $user['name'];
|
|
||||||
header("Location: dashboard.php");
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
echo "Password verification failed.";
|
|
||||||
die();
|
|
||||||
$errors[] = 'Invalid password';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "No user found.";
|
|
||||||
die();
|
|
||||||
$errors[] = 'No user found with that email address';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'includes/header.php';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container mt-5 pt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="text-center">Login</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (!empty($errors)): ?>
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<?php foreach ($errors as $error): ?>
|
|
||||||
<p><?php echo $error; ?></p>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="login.php" method="POST">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="password" class="form-label">Password</label>
|
|
||||||
<input type="password" class="form-control" id="password" name="password" required>
|
|
||||||
</div>
|
|
||||||
<div class="d-grid">
|
|
||||||
<button type="submit" class="btn btn-primary">Login</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer text-center">
|
|
||||||
<p>Don't have an account? <a href="register.php">Register here</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
session_unset();
|
|
||||||
session_destroy();
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
72
profile.php
72
profile.php
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'includes/header.php';
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: login.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
$error = '';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$username = $_POST['username'];
|
|
||||||
$email = $_POST['email'];
|
|
||||||
|
|
||||||
if (empty($username) || empty($email)) {
|
|
||||||
$error = 'Username and email are required.';
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$stmt = db()->prepare("UPDATE users SET username = ?, email = ? WHERE id = ?");
|
|
||||||
$stmt->execute([$username, $email, $user_id]);
|
|
||||||
$_SESSION['user_name'] = $username;
|
|
||||||
$message = 'Profile updated successfully!';
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$error = 'Error updating profile: ' . $e->getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
||||||
$stmt->execute([$user_id]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
<h1>User Profile</h1>
|
|
||||||
|
|
||||||
<?php if ($message): ?>
|
|
||||||
<div class="alert alert-success">
|
|
||||||
<?php echo $message; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($error): ?>
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<?php echo $error; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">Edit Your Information</h5>
|
|
||||||
<form action="profile.php" method="POST">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="username" class="form-label">Username</label>
|
|
||||||
<input type="text" class="form-control" id="username" name="username" value="<?php echo htmlspecialchars($user['username']); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>" required>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Update Profile</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
|
||||||
107
register.php
107
register.php
@ -1,107 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$errors = [];
|
|
||||||
$success = '';
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$name = trim($_POST['name']);
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$password = $_POST['password'];
|
|
||||||
$confirm_password = $_POST['confirm_password'];
|
|
||||||
|
|
||||||
if (empty($name)) {
|
|
||||||
$errors[] = 'Name is required';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($email)) {
|
|
||||||
$errors[] = 'Email is required';
|
|
||||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$errors[] = 'Invalid email format';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($password)) {
|
|
||||||
$errors[] = 'Password is required';
|
|
||||||
} elseif (strlen($password) < 8) {
|
|
||||||
$errors[] = 'Password must be at least 8 characters long';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($password !== $confirm_password) {
|
|
||||||
$errors[] = 'Passwords do not match';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($errors)) {
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
|
||||||
$stmt->execute([$email]);
|
|
||||||
$existing_user = $stmt->fetch();
|
|
||||||
|
|
||||||
if ($existing_user) {
|
|
||||||
$errors[] = 'Email already exists';
|
|
||||||
} else {
|
|
||||||
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO users (name, email, password_hash) VALUES (?, ?, ?)");
|
|
||||||
if ($stmt->execute([$name, $email, $password_hash])) {
|
|
||||||
$success = "Registration successful! You can now <a href='login.php'>login</a>.";
|
|
||||||
} else {
|
|
||||||
$errors[] = 'Failed to register. Please try again.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'includes/header.php';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container mt-5 pt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="text-center">Register</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (!empty($errors)): ?>
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<?php foreach ($errors as $error): ?>
|
|
||||||
<p><?php echo $error; ?></p>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (!empty($success)): ?>
|
|
||||||
<div class="alert alert-success">
|
|
||||||
<p><?php echo $success; ?></p>
|
|
||||||
</div>
|
|
||||||
<?php else: ?>
|
|
||||||
<form action="register.php" method="POST">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="name" class="form-label">Name</label>
|
|
||||||
<input type="text" class="form-control" id="name" name="name" required value="<?php echo isset($_POST['name']) ? htmlspecialchars($_POST['name']) : ''; ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" required value="<?php echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="password" class="form-label">Password</label>
|
|
||||||
<input type="password" class="form-control" id="password" name="password" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="confirm_password" class="form-label">Confirm Password</label>
|
|
||||||
<input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
|
|
||||||
</div>
|
|
||||||
<div class="d-grid">
|
|
||||||
<button type="submit" class="btn btn-primary">Register</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer text-center">
|
|
||||||
<p>Already have an account? <a href="login.php">Login here</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '../includes/header.php';
|
|
||||||
require_once '../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: ../login.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
// Get the service ID for 'Email Newsletters'
|
|
||||||
$p = db()->prepare('SELECT id FROM services WHERE name = ?');
|
|
||||||
$p->execute(['Email Newsletters']);
|
|
||||||
$service = $p->fetch();
|
|
||||||
|
|
||||||
if (!$service) {
|
|
||||||
die('Email service not found.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$service_id = $service['id'];
|
|
||||||
|
|
||||||
// Check if the user is subscribed to this service
|
|
||||||
$p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?');
|
|
||||||
$p->execute([$user_id, $service_id]);
|
|
||||||
$subscription = $p->fetch();
|
|
||||||
|
|
||||||
if (!$subscription) {
|
|
||||||
die('You are not subscribed to this service. <a href="../subscribe.php">Subscribe now</a>');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Email Newsletters</h1>
|
|
||||||
<p class="lead">This is where the email newsletter functionality would be.</p>
|
|
||||||
<p>You could have a list of past newsletters here, or a form to manage your subscription preferences.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once '../includes/footer.php'; ?>
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '../includes/header.php';
|
|
||||||
require_once '../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: ../login.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
// Get the service ID for 'SMS Notifications'
|
|
||||||
$p = db()->prepare('SELECT id FROM services WHERE name = ?');
|
|
||||||
$p->execute(['SMS Notifications']);
|
|
||||||
$service = $p->fetch();
|
|
||||||
|
|
||||||
if (!$service) {
|
|
||||||
die('SMS service not found.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$service_id = $service['id'];
|
|
||||||
|
|
||||||
// Check if the user is subscribed to this service
|
|
||||||
$p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?');
|
|
||||||
$p->execute([$user_id, $service_id]);
|
|
||||||
$subscription = $p->fetch();
|
|
||||||
|
|
||||||
if (!$subscription) {
|
|
||||||
die('You are not subscribed to this service. <a href="../subscribe.php">Subscribe now</a>');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">SMS Notifications</h1>
|
|
||||||
<p class="lead">This is where the SMS notification functionality would be.</p>
|
|
||||||
<p>You could have a form here to send an SMS, or view a history of sent messages.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once '../includes/footer.php'; ?>
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once '../includes/header.php';
|
|
||||||
require_once '../db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: ../login.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
// Get the service ID for 'Voice Calls'
|
|
||||||
$p = db()->prepare('SELECT id FROM services WHERE name = ?');
|
|
||||||
$p->execute(['Voice Calls']);
|
|
||||||
$service = $p->fetch();
|
|
||||||
|
|
||||||
if (!$service) {
|
|
||||||
die('Voice service not found.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$service_id = $service['id'];
|
|
||||||
|
|
||||||
// Check if the user is subscribed to this service
|
|
||||||
$p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?');
|
|
||||||
$p->execute([$user_id, $service_id]);
|
|
||||||
$subscription = $p->fetch();
|
|
||||||
|
|
||||||
if (!$subscription) {
|
|
||||||
die('You are not subscribed to this service. <a href="../subscribe.php">Subscribe now</a>');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Voice Calls</h1>
|
|
||||||
<p class="lead">This is where the voice call functionality would be.</p>
|
|
||||||
<p>You could have a feature to initiate calls, or view your call history.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once '../includes/footer.php'; ?>
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'includes/header.php';
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
header('Location: login.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id = $_SESSION['user_id'];
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['service_id'])) {
|
|
||||||
$service_id = $_POST['service_id'];
|
|
||||||
|
|
||||||
$p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?');
|
|
||||||
$p->execute([$user_id, $service_id]);
|
|
||||||
$existing_subscription = $p->fetch();
|
|
||||||
|
|
||||||
if (!$existing_subscription) {
|
|
||||||
$p = db()->prepare('INSERT INTO user_services (user_id, service_id) VALUES (?, ?)');
|
|
||||||
$p->execute([$user_id, $service_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: subscribe.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$p = db()->prepare('SELECT * FROM services');
|
|
||||||
$p->execute();
|
|
||||||
$services = $p->fetchAll();
|
|
||||||
|
|
||||||
$p = db()->prepare('SELECT service_id FROM user_services WHERE user_id = ?');
|
|
||||||
$p->execute([$user_id]);
|
|
||||||
$subscribed_services = $p->fetchAll(PDO::FETCH_COLUMN);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="mt-5">Subscribe to Services</h1>
|
|
||||||
<p class="lead">Browse our available services and subscribe to the ones you need.</p>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<?php foreach ($services as $service): ?>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card mb-4">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title"><?php echo htmlspecialchars($service['name']); ?></h5>
|
|
||||||
<p class="card-text"><?php echo htmlspecialchars($service['description']); ?></p>
|
|
||||||
<?php if (in_array($service['id'], $subscribed_services)): ?>
|
|
||||||
<button class="btn btn-secondary" disabled>Subscribed</button>
|
|
||||||
<?php else: ?>
|
|
||||||
<form action="subscribe.php" method="POST">
|
|
||||||
<input type="hidden" name="service_id" value="<?php echo $service['id']; ?>">
|
|
||||||
<button type="submit" class="btn btn-primary">Subscribe</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once 'includes/footer.php'; ?>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user