Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9821bc440 |
71
admin/login.php
Normal file
71
admin/login.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
if (isset($_POST['username'], $_POST['password'])) {
|
||||||
|
$username = $_POST['username'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
|
||||||
|
$stmt->execute([$username]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
header('Location: orders.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error_message = 'Invalid username or password.';
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = 'Database error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin - Login</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="text-center">Admin Login</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($error_message): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="login.php" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="username" class="form-label">Username</label>
|
||||||
|
<input type="text" name="username" id="username" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" name="password" id="password" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary">Login</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
admin/logout.php
Normal file
6
admin/logout.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
81
admin/orders.php
Normal file
81
admin/orders.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query('SELECT * FROM orders ORDER BY order_date DESC');
|
||||||
|
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Could not fetch orders: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin - Orders</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1>Orders</h1>
|
||||||
|
<a href="logout.php" class="btn btn-danger">Logout</a>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Company Name</th>
|
||||||
|
<th>Contact Person</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Phone</th>
|
||||||
|
<th>Quantity</th>
|
||||||
|
<th>Delivery Address</th>
|
||||||
|
<th>Order Date</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($orders)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" class="text-center">No orders found.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($orders as $order): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($order['id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['company_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['contact_person']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['email']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['phone']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['quantity']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['delivery_address']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($order['order_date']); ?></td>
|
||||||
|
<td>
|
||||||
|
<form action="update_order_status.php" method="post">
|
||||||
|
<input type="hidden" name="order_id" value="<?php echo $order['id']; ?>">
|
||||||
|
<select name="status" class="form-select">
|
||||||
|
<option value="pending" <?php echo ($order['status'] === 'pending') ? 'selected' : ''; ?>>Pending</option>
|
||||||
|
<option value="processed" <?php echo ($order['status'] === 'processed') ? 'selected' : ''; ?>>Processed</option>
|
||||||
|
<option value="shipped" <?php echo ($order['status'] === 'shipped') ? 'selected' : ''; ?>>Shipped</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm mt-1">Update</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
24
admin/update_order_status.php
Normal file
24
admin/update_order_status.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
if (isset($_POST['order_id'], $_POST['status'])) {
|
||||||
|
$order_id = $_POST['order_id'];
|
||||||
|
$status = $_POST['status'];
|
||||||
|
|
||||||
|
// You might want to add more validation for the status value
|
||||||
|
$allowed_statuses = ['pending', 'processed', 'shipped'];
|
||||||
|
if (in_array($status, $allowed_statuses)) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare('UPDATE orders SET status = ? WHERE id = ?');
|
||||||
|
$stmt->execute([$status, $order_id]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Could not update order status: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: orders.php');
|
||||||
|
exit;
|
||||||
147
assets/css/custom.css
Normal file
147
assets/css/custom.css
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
body {
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: 'Montserrat', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section {
|
||||||
|
min-height: 90vh;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
position: relative;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .container {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section h1 {
|
||||||
|
color: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section p {
|
||||||
|
color: #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .display-4 {
|
||||||
|
animation: fadeInDown 1s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
transition: background-color 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.nav-link {
|
||||||
|
transition: color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.navbar-brand,
|
||||||
|
.nav-link {
|
||||||
|
color: #ffffff !important; /* White for the brand and nav links */
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link:hover,
|
||||||
|
.nav-link:focus {
|
||||||
|
color: #cccccc !important; /* Lighter grey for hover/focus */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
footer a {
|
||||||
|
transition: color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
padding: 80px 0;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
transition: opacity 0.6s ease-out, transform 0.6s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.visible {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: none;
|
||||||
|
border-radius: 15px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#products .card img {
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#products .card:hover img {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
#scroll-to-top {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
display: none;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 20px;
|
||||||
|
transition: all 0.3s;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#scroll-to-top:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/images/hero-background.jpg
Normal file
BIN
assets/images/hero-background.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
BIN
assets/images/product1.jpg
Normal file
BIN
assets/images/product1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/images/product2.jpg
Normal file
BIN
assets/images/product2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/images/product3.jpg
Normal file
BIN
assets/images/product3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/images/product4.jpg
Normal file
BIN
assets/images/product4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
95
assets/js/main.js
Normal file
95
assets/js/main.js
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
|
||||||
|
// Custom JavaScript for TPS Petroleums LLP
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// Smooth scrolling for anchor links
|
||||||
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||||
|
anchor.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const target = document.querySelector(this.getAttribute('href'));
|
||||||
|
if (target) {
|
||||||
|
target.scrollIntoView({
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Order Form Submission
|
||||||
|
const orderForm = document.getElementById('orderForm');
|
||||||
|
if (orderForm) {
|
||||||
|
orderForm.addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const orderData = {
|
||||||
|
companyName: document.getElementById('companyName').value,
|
||||||
|
contactPerson: document.getElementById('contactPerson').value,
|
||||||
|
email: document.getElementById('email').value,
|
||||||
|
phone: document.getElementById('phone').value,
|
||||||
|
quantity: document.getElementById('quantity').value,
|
||||||
|
deliveryAddress: document.getElementById('deliveryAddress').value
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('order_handler.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(orderData)
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
alert(data.message);
|
||||||
|
if (data.status === 'success') {
|
||||||
|
orderForm.reset();
|
||||||
|
const orderModal = bootstrap.Modal.getInstance(document.getElementById('orderModal'));
|
||||||
|
if(orderModal) {
|
||||||
|
orderModal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
alert('An error occurred while placing your order. Please try again.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scroll-to-top button
|
||||||
|
const scrollToTopBtn = document.getElementById('scroll-to-top');
|
||||||
|
if (scrollToTopBtn) {
|
||||||
|
window.addEventListener('scroll', () => {
|
||||||
|
if (window.scrollY > 300) {
|
||||||
|
scrollToTopBtn.classList.remove('d-none');
|
||||||
|
} else {
|
||||||
|
scrollToTopBtn.classList.add('d-none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
scrollToTopBtn.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Fade-in sections on scroll
|
||||||
|
const sections = document.querySelectorAll('section');
|
||||||
|
const observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
entry.target.classList.add('visible');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
threshold: 0.1
|
||||||
|
});
|
||||||
|
|
||||||
|
sections.forEach(section => {
|
||||||
|
observer.observe(section);
|
||||||
|
});
|
||||||
|
});
|
||||||
40
contact_handler.php
Normal file
40
contact_handler.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once __DIR__ . '/mail/MailService.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$message = trim($_POST['message'] ?? '');
|
||||||
|
|
||||||
|
if (empty($name) || empty($email) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$_SESSION['status'] = 'error';
|
||||||
|
$_SESSION['message'] = 'Please fill out all fields correctly.';
|
||||||
|
header('Location: index.php#contact');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The recipient email address. Should be configured in .env as MAIL_TO
|
||||||
|
$to = getenv('MAIL_TO') ?: 'info@tpspetroleums.com';
|
||||||
|
$subject = 'New Contact Form Submission from ' . $name;
|
||||||
|
|
||||||
|
$res = MailService::sendContactMessage($name, $email, $message, $to, $subject);
|
||||||
|
|
||||||
|
if (!empty($res['success'])) {
|
||||||
|
$_SESSION['status'] = 'success';
|
||||||
|
$_SESSION['message'] = 'Thank you for your message! We will get back to you shortly.';
|
||||||
|
} else {
|
||||||
|
$_SESSION['status'] = 'error';
|
||||||
|
$_SESSION['message'] = 'Sorry, there was an error sending your message. Please try again later.';
|
||||||
|
// It's good practice to log the actual error for debugging, but not show it to the user.
|
||||||
|
error_log('MailService Error: ' . ($res['error'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: index.php#contact');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// If not a POST request, redirect home.
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
19
db/migrate.php
Normal file
19
db/migrate.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$migration_files = glob(__DIR__ . '/migrations/*.sql');
|
||||||
|
sort($migration_files);
|
||||||
|
|
||||||
|
foreach ($migration_files as $file) {
|
||||||
|
$sql = file_get_contents($file);
|
||||||
|
$pdo->exec($sql);
|
||||||
|
echo "Migrated: " . basename($file) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "All migrations successful!\n";
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Migration failed: " . $e->getMessage() . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
11
db/migrations/001_create_orders_table.sql
Normal file
11
db/migrations/001_create_orders_table.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS orders (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
company_name VARCHAR(255) NOT NULL,
|
||||||
|
contact_person VARCHAR(255) NOT NULL,
|
||||||
|
email VARCHAR(255) NOT NULL,
|
||||||
|
phone VARCHAR(255) NOT NULL,
|
||||||
|
quantity INT NOT NULL,
|
||||||
|
delivery_address TEXT NOT NULL,
|
||||||
|
order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
status VARCHAR(255) DEFAULT 'pending'
|
||||||
|
);
|
||||||
5
db/migrations/002_create_users_table.sql
Normal file
5
db/migrations/002_create_users_table.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
username VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
password VARCHAR(255) NOT NULL
|
||||||
|
);
|
||||||
29
db/seed_admin.php
Normal file
29
db/seed_admin.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Check if the admin user already exists
|
||||||
|
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
|
||||||
|
$stmt->execute(['admin']);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
echo "Admin user already exists.\n";
|
||||||
|
} else {
|
||||||
|
$username = 'admin';
|
||||||
|
$password = 'password';
|
||||||
|
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare('INSERT INTO users (username, password) VALUES (?, ?)');
|
||||||
|
$stmt->execute([$username, $hashed_password]);
|
||||||
|
|
||||||
|
echo "Admin user created successfully.\n";
|
||||||
|
echo "Username: admin\n";
|
||||||
|
echo "Password: password\n";
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Could not create admin user: " . $e->getMessage() . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
427
index.php
427
index.php
@ -1,150 +1,303 @@
|
|||||||
<?php
|
<?php session_start(); ?>
|
||||||
declare(strict_types=1);
|
<!DOCTYPE html>
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!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>TPS Petroleums LLP - Advanced RDF Biofuel Solutions</title>
|
||||||
<?php
|
<meta name="description" content="High-performance, environmentally responsible biofuel with secure logistics and strict quality control.">
|
||||||
// Read project preview data from environment
|
<meta name="keywords" content="biofuel, RDF biofuel, renewable energy, industrial fuel, TPS Petroleums">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<!-- Bootstrap CSS -->
|
||||||
?>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
<!-- Google Fonts -->
|
||||||
<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.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<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">
|
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Poppins:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
<style>
|
|
||||||
:root {
|
<!-- Bootstrap Icons -->
|
||||||
--bg-color-start: #6a11cb;
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
<!-- Custom CSS -->
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
--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>
|
||||||
|
|
||||||
|
<!-- Scroll to Top Button -->
|
||||||
|
<a href="#" id="scroll-to-top" class="d-none"><i class="bi bi-arrow-up-short"></i></a>
|
||||||
|
|
||||||
|
<!-- Header & Navigation -->
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand fw-bold" href="#">TPS Petroleums LLP</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="#">Home</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#about">About Us</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#quality">Quality & Assurance</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#product">Product</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#sustainability">Sustainability</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#logistics">Logistics</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Hero Section -->
|
||||||
<main>
|
<main>
|
||||||
<div class="card">
|
<section class="hero-section text-white d-flex justify-content-center align-items-center" style="background-image: url('assets/images/hero-background.jpg');">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container text-center">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<h1 class="display-3 fw-bold">Advanced RDF Biofuel Solutions for a Cleaner Industrial Future</h1>
|
||||||
<span class="sr-only">Loading…</span>
|
<p class="lead my-4">High-performance, environmentally responsible biofuel with secure logistics and strict quality control.</p>
|
||||||
|
<a href="#product" class="btn btn-primary btn-lg mx-2">Explore Our Product</a>
|
||||||
|
<a href="#contact" class="btn btn-outline-light btn-lg mx-2">Contact Us</a>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</section>
|
||||||
<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>
|
<section id="about" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="fw-bold">Company Focus</h2>
|
||||||
|
<p class="lead text-muted">TPS Petroleums LLP delivers advanced RDF Biofuel solutions with a strong emphasis on quality control, secure logistics, and environmental sustainability. The company uses innovative processing technology to ensure reliable, high-performance biofuel for industrial applications.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<div class="mb-3"><i class="bi bi-shield-check display-4 text-primary"></i></div>
|
||||||
|
<h4>Quality Control</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<div class="mb-3"><i class="bi bi-truck display-4 text-primary"></i></div>
|
||||||
|
<h4>Secure Logistics</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<div class="mb-3"><i class="bi bi-leaf display-4 text-primary"></i></div>
|
||||||
|
<h4>Sustainability</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="quality" class="bg-light py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="fw-bold">Multi-Stage Quality Assurance</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 mb-4"><div class="card h-100 text-center shadow-sm"><div class="card-body"><div class="mb-3"><i class="bi bi-eyedropper display-4 text-primary"></i></div><h5 class="card-title">Raw Material Testing</h5><p class="card-text">Feedstock analysis before unloading.</p></div></div></div>
|
||||||
|
<div class="col-md-3 mb-4"><div class="card h-100 text-center shadow-sm"><div class="card-body"><div class="mb-3"><i class="bi bi-arrow-repeat display-4 text-primary"></i></div><h5 class="card-title">In-Process Monitoring</h5><p class="card-text">Continuous quality checks.</p></div></div></div>
|
||||||
|
<div class="col-md-3 mb-4"><div class="card h-100 text-center shadow-sm"><div class="card-body"><div class="mb-3"><i class="bi bi-patch-check display-4 text-primary"></i></div><h5 class="card-title">Final Product Verification</h5><p class="card-text">Comprehensive testing before dispatch.</p></div></div></div>
|
||||||
|
<div class="col-md-3 mb-4"><div class="card h-100 text-center shadow-sm"><div class="card-body"><div class="mb-3"><i class="bi bi-file-earmark-text display-4 text-primary"></i></div><h5 class="card-title">Documentation & Sampling</h5><p class="card-text">Test reports and counter samples with every delivery.</p></div></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="product" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="fw-bold">Our Product: RDF Biofuel</h2>
|
||||||
|
<p class="lead text-muted">Manufactured from non-edible vegetable oil for clean and efficient industrial combustion.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="card h-100 text-center">
|
||||||
|
<img src="assets/images/product1.jpg" class="card-img-top" alt="Zero Sludge">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Zero Sludge</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="card h-100 text-center">
|
||||||
|
<img src="assets/images/product2.jpg" class="card-img-top" alt="Low Sulfur">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Low Sulfur</h5>
|
||||||
|
<p class="text-muted">max 0.0034%</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="card h-100 text-center">
|
||||||
|
<img src="assets/images/product3.jpg" class="card-img-top" alt="High Calorific Value">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">High Calorific Value</h5>
|
||||||
|
<p class="text-muted">10,200 kcal/kg</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="card h-100 text-center">
|
||||||
|
<img src="assets/images/product4.jpg" class="card-img-top" alt="Optimal Density">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Optimal Density</h5>
|
||||||
|
<p class="text-muted">0.88–0.92 kg/ltr</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="sustainability" class="mb-5">
|
||||||
|
<h3 class="text-center fw-bold mb-4">Environmental Impact vs. LDO</h3>
|
||||||
|
<div class="row"><div class="col-md-3 text-center"><div class="p-3 border rounded"><h4>99.8%</h4><p class="text-muted">SOx Reduction</p></div></div><div class="col-md-3 text-center"><div class="p-3 border rounded"><h4>40%</h4><p class="text-muted">Particulate Matter Reduction</p></div></div><div class="col-md-3 text-center"><div class="p-3 border rounded"><h4>93%</h4><p class="text-muted">Hydrocarbon Reduction</p></div></div><div class="col-md-3 text-center"><div class="p-3 border rounded"><h4>50%</h4><p class="text-muted">CO Reduction</p></div></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="row text-center mb-5">
|
||||||
|
<div class="col-md-4"><div class="mb-2"><i class="bi bi-gear display-4 text-primary"></i></div><h5>Operational & Safety Advantages</h5><ul class="list-unstyled text-muted"><li>3–4% higher burning efficiency than LDO</li><li>Flash point >70°C for safer storage</li><li>Comparable viscosity to LDO</li></ul></div>
|
||||||
|
<div class="col-md-4"><div class="mb-2"><i class="bi bi-cash-coin display-4 text-primary"></i></div><h5>Economic & Strategic Benefits</h5><ul class="list-unstyled text-muted"><li>Cost-competitive alternative</li><li>Renewable and sustainable</li><li>Uses domestic agricultural feedstock</li></ul></div>
|
||||||
|
<div class="col-md-4"><div class="mb-2"><i class="bi bi-exclamation-triangle display-4 text-primary"></i></div><h5>Lower Toxicity</h5><ul class="list-unstyled text-muted"><li>Better workplace safety</li><li>Non-toxic and biodegradable</li></ul></div>
|
||||||
|
</div>
|
||||||
|
<h3 class="text-center fw-bold mb-4">Technical Specifications</h3>
|
||||||
|
<div class="table-responsive"><table class="table table-bordered table-striped"><thead class="table-dark"><tr><th>Parameter</th><th>RDF Biofuel</th><th>LDO</th></tr></thead><tbody><tr><td>Sulfur %</td><td>< 0.0034%</td><td>~0.5 - 1.8%</td></tr><tr><td>Calorific Value (kcal/kg)</td><td>10,200</td><td>~10,300</td></tr><tr><td>SOx Emissions</td><td>Dramatically Lower</td><td>High</td></tr><tr><td>Safety (Flash Point)</td><td>>70°C (Safer)</td><td>~66°C</td></tr><tr><td>Efficiency</td><td>3-4% Higher</td><td>Standard</td></tr></tbody></table></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="logistics" class="bg-light py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="fw-bold">Logistics & Traceability</h2>
|
||||||
|
<p class="lead text-muted">Our integrated logistics network ensures that your biofuel supply is secure, timely, and fully traceable from our plant to your facility.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<img src="assets/images/pexels/906982.jpg" class="img-fluid rounded shadow-sm" alt="Logistics and Traceability">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li class="mb-3"><i class="bi bi-check-circle-fill text-primary me-2"></i><strong>Detailed Test Reports:</strong> Every shipment includes comprehensive test reports, so you have full visibility into the fuel's specifications.</li>
|
||||||
|
<li class="mb-3"><i class="bi bi-check-circle-fill text-primary me-2"></i><strong>Counter Samples:</strong> For quality assurance, we store counter samples of every delivery for one month.</li>
|
||||||
|
<li class="mb-3"><i class="bi bi-check-circle-fill text-primary me-2"></i><strong>Sealed Invoices:</strong> All invoices and challans are dispatched with a unique seal number to ensure tamper-proof documentation.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="conclusion-section bg-secondary text-white py-5">
|
||||||
|
<div class="container text-center">
|
||||||
|
<h2 class="fw-bold">A Complete Biofuel Solution</h2>
|
||||||
|
<p class="lead">TPS Petroleums LLP provides a complete biofuel solution combining quality assurance, secure logistics, and environmentally responsible RDF Biofuel technology—offering cost savings, improved efficiency, and major emission reductions.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="contact" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="fw-bold">Contact Us</h2>
|
||||||
|
<p class="lead text-muted">Get in touch for inquiries or to place an order.</p>
|
||||||
|
<button class="btn btn-primary btn-lg" data-bs-toggle="modal" data-bs-target="#orderModal">Place an Order</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_SESSION['status']) && isset($_SESSION['message'])): ?>
|
||||||
|
<div class="alert alert-<?php echo $_SESSION['status'] === 'success' ? 'success' : 'danger'; ?> alert-dismissible fade show" role="alert">
|
||||||
|
<?php echo htmlspecialchars($_SESSION['message']); ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
unset($_SESSION['status']);
|
||||||
|
unset($_SESSION['message']);
|
||||||
|
?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 mx-auto">
|
||||||
|
<form action="contact_handler.php" method="post">
|
||||||
|
<div class="mb-3"><input type="text" name="name" class="form-control" placeholder="Your Name" required></div>
|
||||||
|
<div class="mb-3"><input type="email" name="email" class="form-control" placeholder="Your Email" required></div>
|
||||||
|
<div class="mb-3"><textarea name="message" class="form-control" rows="5" placeholder="Your Message" required></textarea></div>
|
||||||
|
<div class="text-center"><button type="submit" class="btn btn-primary">Send Message</button></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<!-- Footer -->
|
||||||
|
<footer class="bg-dark text-white py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>TPS Petroleums LLP</h5>
|
||||||
|
<p class="text-muted">Your partner in sustainable energy solutions.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>Quick Links</h5>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li><a href="#" class="text-white text-decoration-none">Home</a></li>
|
||||||
|
<li><a href="#about" class="text-white text-decoration-none">About Us</a></li>
|
||||||
|
<li><a href="#product" class="text-white text-decoration-none">Product</a></li>
|
||||||
|
<li><a href="#contact" class="text-white text-decoration-none">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>Contact Us</h5>
|
||||||
|
<p class="text-muted">
|
||||||
|
Email: info@tpspetroleums.com<br>
|
||||||
|
Phone: +91 123 456 7890
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-4 text-muted">
|
||||||
|
<p>© <?php echo date("Y"); ?> TPS Petroleums LLP. All Rights Reserved.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
|
||||||
|
<!-- Order Modal -->
|
||||||
|
<div class="modal fade" id="orderModal" tabindex="-1" aria-labelledby="orderModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="orderModalLabel">Place an Order</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="orderForm">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="companyName" class="form-label">Company Name</label>
|
||||||
|
<input type="text" class="form-control" id="companyName" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="contactPerson" class="form-label">Contact Person</label>
|
||||||
|
<input type="text" class="form-control" id="contactPerson" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email Address</label>
|
||||||
|
<input type="email" class="form-control" id="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phone" class="form-label">Phone Number</label>
|
||||||
|
<input type="tel" class="form-control" id="phone" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="quantity" class="form-label">Quantity (in Liters)</label>
|
||||||
|
<input type="number" class="form-control" id="quantity" required min="1000">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="deliveryAddress" class="form-label">Delivery Address</label>
|
||||||
|
<textarea class="form-control" id="deliveryAddress" rows="3" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-check mb-3">
|
||||||
|
<input class="form-check-input" type="checkbox" value="" id="termsCheck" required>
|
||||||
|
<label class="form-check-label" for="termsCheck">
|
||||||
|
I agree to the terms and conditions.
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit Order</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
38
order_handler.php
Normal file
38
order_handler.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$response = ['status' => 'error', 'message' => 'An unknown error occurred.'];
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (isset($data['companyName'], $data['contactPerson'], $data['email'], $data['phone'], $data['quantity'], $data['deliveryAddress'])) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare(
|
||||||
|
'INSERT INTO orders (company_name, contact_person, email, phone, quantity, delivery_address) VALUES (?, ?, ?, ?, ?, ?)'
|
||||||
|
);
|
||||||
|
$stmt->execute([
|
||||||
|
$data['companyName'],
|
||||||
|
$data['contactPerson'],
|
||||||
|
$data['email'],
|
||||||
|
$data['phone'],
|
||||||
|
$data['quantity'],
|
||||||
|
$data['deliveryAddress']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response['status'] = 'success';
|
||||||
|
$response['message'] = 'Your order has been placed successfully!';
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$response['message'] = 'Database error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response['message'] = 'Invalid input. Please fill out all fields.';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response['message'] = 'Invalid request method.';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
Loading…
x
Reference in New Issue
Block a user