This commit is contained in:
Flatlogic Bot 2025-09-24 04:05:20 +00:00
parent 7fa2907f6a
commit a7265cf7d7
5 changed files with 426 additions and 125 deletions

79
assets/css/custom.css Normal file
View File

@ -0,0 +1,79 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #FFFFFF;
color: #1F2937;
}
.bg-primary-custom {
background-color: #3B82F6;
}
.btn-primary-custom {
background-color: #3B82F6;
border-color: #3B82F6;
color: #FFFFFF;
}
.btn-primary-custom:hover {
background-color: #2563EB;
border-color: #2563EB;
}
.text-accent-custom {
color: #10B981;
}
.logo {
font-weight: 700;
font-size: 1.5rem;
}
.logo .q {
color: #10B981;
}
/* Login Page */
.login-container {
min-height: 100vh;
background-image: linear-gradient(to right, rgba(255,255,255,0.95), rgba(255,255,255,0.9)), url('https://picsum.photos/seed/loginbg/1920/1080');
background-size: cover;
background-position: center;
}
.login-card {
background-color: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border: 1px solid rgba(209, 213, 219, 0.3);
}
/* Dashboard */
.sidebar {
background-color: #F3F4F6;
height: 100vh;
position: fixed;
top: 0;
left: 0;
width: 250px;
padding-top: 1.5rem;
}
.sidebar .nav-link {
color: #1F2937;
font-weight: 500;
margin: 0.5rem 0;
}
.sidebar .nav-link.active,
.sidebar .nav-link:hover {
color: #3B82F6;
background-color: #E0E7FF;
border-radius: 8px;
}
.main-content {
margin-left: 250px;
padding: 2rem;
}

35
assets/js/main.js Normal file
View File

@ -0,0 +1,35 @@
document.addEventListener('DOMContentLoaded', function () {
const fileUploadInput = document.getElementById('fileUpload');
const printOptionsModal = new bootstrap.Modal(document.getElementById('printOptionsModal'));
const uploadForm = document.getElementById('uploadForm');
const fileNameSpan = document.getElementById('fileName');
const filePreview = document.getElementById('filePreview');
fileUploadInput.addEventListener('change', function () {
if (this.files && this.files[0]) {
const file = this.files[0];
fileNameSpan.textContent = file.name;
// Simple preview for images
if (file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = function (e) {
filePreview.innerHTML = `<img src="${e.target.result}" class="img-fluid" alt="File preview">`;
};
reader.readAsDataURL(file);
} else {
// Placeholder for non-image files
filePreview.innerHTML = '<i class="bi bi-file-earmark-text display-1 text-muted"></i>';
}
printOptionsModal.show();
}
});
// Optional: If you want the form to submit from the modal button
// const confirmPrintBtn = document.getElementById('confirmPrintBtn');
// confirmPrintBtn.addEventListener('click', function () {
// uploadForm.submit();
// });
});

300
index.php
View File

@ -1,131 +1,187 @@
<?php
declare(strict_types=1);
@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>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - SREC SmartQ Print Hub</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="assets/css/custom.css">
</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 class="sidebar d-flex flex-column p-3">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-decoration-none">
<h1 class="logo">Smart<span class="q">Q</span></h1>
</a>
<hr>
<ul class="nav nav-pills flex-column mb-auto">
<li class="nav-item">
<a href="#" class="nav-link active" aria-current="page">
<i class="bi bi-cloud-arrow-up-fill me-2"></i>
Upload & Print
</a>
</li>
<li>
<a href="#" class="nav-link">
<i class="bi bi-clock-history me-2"></i>
Order History
</a>
</li>
<li>
<a href="#" class="nav-link">
<i class="bi bi-wallet2 me-2"></i>
Wallet
</a>
</li>
<li>
<a href="#" class="nav-link">
<i class="bi bi-tools me-2"></i>
Extra Tools
</a>
</li>
</ul>
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center text-decoration-none dropdown-toggle" id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
<img src="https://picsum.photos/seed/avatar/100/100" alt="User avatar" width="32" height="32" class="rounded-circle me-2">
<strong>Student User</strong>
</a>
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="dropdownUser1">
<li><a class="dropdown-item" href="#">Profile</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="login.php">Sign out</a></li>
</ul>
</div>
</div>
<main class="main-content">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Upload & Print</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group me-2">
<button type="button" class="btn btn-sm btn-outline-secondary">EN</button>
<button type="button" class="btn btn-sm btn-outline-secondary">TA</button>
</div>
</div>
</div>
<form id="uploadForm" action="upload.php" method="post" enctype="multipart/form-data">
<div class="card shadow-sm" style="border-radius: 12px;">
<div class="card-body p-5 text-center">
<i class="bi bi-cloud-arrow-up display-1 text-primary-custom"></i>
<h5 class="card-title mt-3">Select a file to print</h5>
<p class="card-text text-muted">Supports PDF, Word, and Images.</p>
<label for="fileUpload" class="btn btn-primary-custom btn-lg">
<i class="bi bi-upload me-2"></i>
Browse File
</label>
<input type="file" name="fileUpload" id="fileUpload" class="d-none">
</div>
</div>
<!-- Print Options Modal -->
<div class="modal fade" id="printOptionsModal" tabindex="-1" aria-labelledby="printOptionsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="printOptionsModalLabel">Print Options for <span id="fileName" class="fw-bold"></span></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 text-center">
<h6>Print Preview</h6>
<div id="filePreview" class="border rounded p-2" style="height: 300px; display: flex; align-items: center; justify-content: center;">
<p class="text-muted">Preview will appear here</p>
</div>
</div>
<div class="col-md-6">
<h6>Configuration</h6>
<div class="mb-3">
<label class="form-label">Printing Location</label>
<select class="form-select" name="location" required>
<option value="library">Library</option>
<option value="food_court">Food Court</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Color</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="color" id="colorBW" value="bw" checked>
<label class="form-check-label" for="colorBW">Black & White</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="color" id="colorColor" value="color">
<label class="form-check-label" for="colorColor">Color</label>
</div>
</div>
<div class="mb-3">
<label class="form-label">Sides</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="sides" id="sidesSingle" value="single" checked>
<label class="form-check-label" for="sidesSingle">Single-Sided</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="sides" id="sidesDouble" value="double">
<label class="form-check-label" for="sidesDouble">Double-Sided</label>
</div>
</div>
<div class="mb-3">
<label for="paperSize" class="form-label">Paper Size</label>
<select class="form-select" id="paperSize" name="paperSize">
<option value="A4">A4</option>
<option value="Letter">Letter</option>
<option value="Legal">Legal</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Orientation</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="orientation" id="orientationPortrait" value="portrait" checked>
<label class="form-check-label" for="orientationPortrait">Portrait</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="orientation" id="orientationLandscape" value="landscape">
<label class="form-check-label" for="orientationLandscape">Landscape</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary-custom" id="confirmPrintBtn">Confirm & Proceed to Pay</button>
</div>
</div>
</div>
</div>
</form>
<footer class="pt-4 my-md-5 pt-md-5 border-top">
<div class="row">
<div class="col-12 col-md">
<small class="d-block mb-3 text-muted">&copy; 2025 SREC SmartQ Print Hub</small>
</div>
<div class="col-6 col-md">
<h5>Navigation</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary" href="#">Upload</a></li>
<li><a class="link-secondary" href="#">History</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>Legal</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary" href="#">Privacy Policy</a></li>
<li><a class="link-secondary" href="#">Terms of Service</a></li>
</ul>
</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>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>

39
login.php Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - SREC SmartQ Print Hub</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css">
</head>
<body>
<div class="container-fluid login-container d-flex align-items-center justify-content-center">
<div class="card login-card shadow-lg p-4" style="width: 100%; max-width: 400px; border-radius: 12px;">
<div class="card-body">
<div class="text-center mb-4">
<h1 class="logo">Smart<span class="q">Q</span></h1>
<p class="text-muted">SREC Print Hub</p>
</div>
<form action="index.php">
<div class="mb-3">
<label for="email" class="form-label">Email address</label>
<input type="email" class="form-control" id="email" placeholder="student@srec.ac.in" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="••••••••" required>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary-custom">Login</button>
</div>
</form>
<div class="text-center mt-3">
<small class="text-muted">New user? <a href="#">Register here</a></small>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

92
upload.php Normal file
View File

@ -0,0 +1,92 @@
<?php
// Basic security check
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo "Method Not Allowed";
exit;
}
$uploadDir = 'uploads/';
$response = [
'success' => false,
'message' => 'An unknown error occurred.'
];
if (isset($_FILES['fileUpload']) && $_FILES['fileUpload']['error'] === UPLOAD_ERR_OK) {
$fileTmpPath = $_FILES['fileUpload']['tmp_name'];
$fileName = $_FILES['fileUpload']['name'];
$fileSize = $_FILES['fileUpload']['size'];
$fileType = $_FILES['fileUpload']['type'];
$fileNameCmps = explode(".", $fileName);
$fileExtension = strtolower(end($fileNameCmps));
// Sanitize file name
$newFileName = md5(time() . $fileName) . '.' . $fileExtension;
$destPath = $uploadDir . $newFileName;
// Check if file is allowed
$allowedfileExtensions = ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png'];
if (in_array($fileExtension, $allowedfileExtensions)) {
if(move_uploaded_file($fileTmpPath, $destPath)) {
$response['success'] = true;
// In a real app, you would save this info to the database
$response['message'] = "File uploaded successfully!";
$response['data'] = [
'original_name' => htmlspecialchars($fileName),
'new_name' => $newFileName,
'path' => $destPath,
'print_options' => [
'location' => htmlspecialchars($_POST['location'] ?? 'N/A'),
'color' => htmlspecialchars($_POST['color'] ?? 'N/A'),
'sides' => htmlspecialchars($_POST['sides'] ?? 'N/A'),
'paper_size' => htmlspecialchars($_POST['paperSize'] ?? 'N/A'),
'orientation' => htmlspecialchars($_POST['orientation'] ?? 'N/A'),
]
];
} else {
$response['message'] = 'There was some error moving the file to upload directory.';
}
} else {
$response['message'] = 'Upload failed. Allowed file types: ' . implode(', ', $allowedfileExtensions);
}
} else {
$response['message'] = 'Error uploading file. Error code: ' . $_FILES['fileUpload']['error'];
}
// For demonstration, we'll just print the response.
// In a real app, you might redirect with a status message.
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Status</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css">
</head>
<body>
<div class="container mt-5">
<div class="card shadow-sm">
<div class="card-body text-center">
<h1 class="card-title"><?= $response['success'] ? '✅ Success' : '❌ Error' ?></h1>
<p class="lead"><?= htmlspecialchars($response['message']) ?></p>
<?php if ($response['success']): ?>
<div class="alert alert-info text-start">
<h5>Order Details:</h5>
<p><strong>File:</strong> <?= $response['data']['original_name'] ?></p>
<p><strong>Location:</strong> <?= $response['data']['print_options']['location'] ?></p>
<p><strong>Color:</strong> <?= $response['data']['print_options']['color'] ?></p>
<p><strong>Sides:</strong> <?= $response['data']['print_options']['sides'] ?></p>
<p><strong>Paper Size:</strong> <?= $response['data']['print_options']['paper_size'] ?></p>
<p><strong>Orientation:</strong> <?= $response['data']['print_options']['orientation'] ?></p>
<hr>
<p class="text-muted small">Next step would be to calculate the bill and proceed to payment.</p>
</div>
<?php endif; ?>
<a href="index.php" class="btn btn-primary-custom mt-3">Return to Dashboard</a>
</div>
</div>
</div>
</body>
</html>