php short

This commit is contained in:
Flatlogic Bot 2025-10-07 13:39:35 +00:00
parent 95a8de862b
commit 60e9259c7a
3 changed files with 309 additions and 145 deletions

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

@ -0,0 +1,109 @@
/* General Body Styles */
body {
background-color: #F5F5F7;
color: #1D1D1F;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica Neue, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-family: 'Georgia', serif;
font-weight: 700;
}
.display-4 {
font-size: 3.5rem;
line-height: 1.2;
}
/* Buttons */
.btn-primary {
background-image: linear-gradient(45deg, #5E5DF0, #8E8DFF);
border: none;
color: white;
padding: 1rem 2rem;
border-radius: 0.75rem;
font-weight: 600;
transition: transform 0.2s ease, box-shadow 0.2s ease;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(94, 93, 240, 0.4);
color: white;
}
.btn-secondary {
background-color: #e9ecef;
border-color: #e9ecef;
color: #1D1D1F;
}
/* Forms */
.form-control-lg {
border-radius: 0.75rem;
padding: 1rem 1.5rem;
border: 1px solid #E5E5E7;
}
.form-control-lg:focus {
border-color: #5E5DF0;
box-shadow: 0 0 0 4px rgba(94, 93, 240, 0.1);
}
/* Hero Section */
.hero {
padding: 6rem 0;
background-color: #FFFFFF;
border-bottom: 1px solid #E5E5E7;
}
/* Features Section */
.features {
padding: 5rem 0;
}
.feature-card {
background-color: #FFFFFF;
border-radius: 0.75rem;
padding: 2rem;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
transition: transform 0.2s ease, box-shadow 0.2s ease;
border: 1px solid #E5E5E7;
height: 100%;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}
.feature-card img {
border-radius: 0.5rem;
}
/* Result Display */
#result {
background-color: #FFFFFF;
border-radius: 0.75rem;
padding: 1.5rem;
margin-top: 2rem;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
border: 1px solid #E5E5E7;
display: none; /* Hidden by default */
}
#result p {
margin-bottom: 0.5rem;
}
#short-url {
font-weight: 600;
color: #5E5DF0;
word-break: break-all;
}
/* Footer */
footer {
padding: 3rem 0;
font-size: 0.9rem;
color: #6E6E73;
}

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

@ -0,0 +1,50 @@
document.addEventListener('DOMContentLoaded', function () {
const shortenForm = document.getElementById('shortenForm');
const urlInput = document.getElementById('urlInput');
const resultDiv = document.getElementById('result');
const shortUrlSpan = document.getElementById('short-url');
const copyBtn = document.getElementById('copyBtn');
shortenForm.addEventListener('submit', function (e) {
e.preventDefault();
const longUrl = urlInput.value.trim();
// Simple URL validation
if (!isValidHttpUrl(longUrl)) {
alert('Please enter a valid URL (e.g., https://example.com)');
urlInput.focus();
return;
}
// --- Dummy Shortener Logic ---
// In a real app, this would be an API call.
const randomString = Math.random().toString(36).substring(2, 8);
const shortUrl = `yourdomain.com/${randomString}`;
// --- End Dummy Logic ---
shortUrlSpan.textContent = shortUrl;
resultDiv.style.display = 'block';
});
copyBtn.addEventListener('click', function() {
navigator.clipboard.writeText(shortUrlSpan.textContent).then(() => {
copyBtn.textContent = 'Copied!';
setTimeout(() => {
copyBtn.textContent = 'Copy';
}, 2000);
}).catch(err => {
console.error('Failed to copy: ', err);
});
});
function isValidHttpUrl(string) {
let url;
try {
url = new URL(string);
} catch (_) {
return false;
}
return url.protocol === "http:" || url.protocol === "https:";
}
});

273
index.php
View File

@ -1,150 +1,155 @@
<?php <!DOCTYPE html>
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>
<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>
<?php <!-- SEO & Meta Tags -->
// Read project preview data from environment <title>Create a URL Shortener SaaS</title>
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <meta name="description" content="Generate beautiful bio profiles, share a single link and monitor traffic. Create custom QR codes and shorten URLs with advanced analytics.">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <meta name="keywords" content="url shortener, link in bio, qr code generator, saas, link management, custom domains, analytics, bio profiles, digital marketing, social media links">
?>
<?php if ($projectDescription): ?> <!-- Open Graph / Facebook -->
<!-- Meta description --> <meta property="og:type" content="website">
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> <meta property="og:title" content="Create a URL Shortener SaaS">
<!-- Open Graph meta tags --> <meta property="og:description" content="Generate beautiful bio profiles, share a single link and monitor traffic. Create custom QR codes and shorten URLs with advanced analytics.">
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? 'https://picsum.photos/seed/og/1200/630'); ?>">
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <!-- Twitter -->
<?php endif; ?> <meta property="twitter:card" content="summary_large_image">
<?php if ($projectImageUrl): ?> <meta property="twitter:title" content="Create a URL Shortener SaaS">
<!-- Open Graph image --> <meta property="twitter:description" content="Generate beautiful bio profiles, share a single link and monitor traffic. Create custom QR codes and shorten URLs with advanced analytics.">
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <meta property="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? 'https://picsum.photos/seed/og/1200/630'); ?>">
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <!-- Stylesheets -->
<?php endif; ?> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<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> <style>
:root { .hero {
--bg-color-start: #6a11cb; background-image: url('https://picsum.photos/seed/hero/1600/900');
--bg-color-end: #2575fc; background-size: cover;
--text-color: #ffffff; background-position: center;
--card-bg-color: rgba(255, 255, 255, 0.01); color: white;
--card-border-color: rgba(255, 255, 255, 0.1);
} }
body { .hero-overlay {
margin: 0; background-color: rgba(0, 0, 0, 0.6);
font-family: 'Inter', sans-serif; padding: 6rem 0;
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 { .hero h1, .hero p {
content: ''; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
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> </style>
</head> </head>
<body> <body>
<header class="py-3 mb-4 border-bottom bg-white">
<div class="container d-flex flex-wrap justify-content-center">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<span class="fs-4 fw-bold">LinkHub</span>
</a>
<ul class="nav nav-pills">
<li class="nav-item"><a href="#" class="nav-link active" aria-current="page">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link text-dark">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link text-dark">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link text-dark">Login</a></li>
</ul>
</div>
</header>
<main> <main>
<div class="card"> <section class="hero text-center">
<h1>Analyzing your requirements and generating your website…</h1> <div class="hero-overlay">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <div class="container">
<span class="sr-only">Loading…</span> <h1 class="display-4 fw-bold">One Link to Rule Them All</h1>
<p class="lead col-lg-8 mx-auto">Create short links, beautiful bio pages, and scannable QR codes. All in one platform designed to grow your brand.</p>
<div class="col-lg-8 mx-auto mt-5">
<form id="shortenForm" class="row g-2 align-items-center">
<div class="col">
<label for="urlInput" class="visually-hidden">URL to shorten</label>
<input type="url" class="form-control form-control-lg" id="urlInput" placeholder="Enter your long URL here..." required>
</div> </div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p> <div class="col-auto">
<p class="hint">This page will update automatically as the plan is implemented.</p> <button type="submit" class="btn btn-primary btn-lg">Shorten</button>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div> </div>
</form>
<div id="result" class="mt-4 text-start">
<p class="mb-2"><strong>Your short link is ready!</strong></p>
<div class="d-flex justify-content-between align-items-center bg-light p-3 rounded">
<span id="short-url" class="text-primary fw-bold"></span>
<button id="copyBtn" class="btn btn-sm btn-secondary">Copy</button>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="features text-center">
<div class="container">
<h2 class="mb-5">A Powerful Suite of Tools</h2>
<div class="row">
<div class="col-md-4 mb-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/bio/400/300" class="img-fluid mb-3" alt="Illustration of a mobile phone displaying a personal bio link profile.">
<h3 class="h4">Bio Link Pages</h3>
<p>Create a stunning "link in bio" page that directs your audience to all your important content with a single URL.</p>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/qr/400/300" class="img-fluid mb-3" alt="Stylized QR code with a logo in the center.">
<h3 class="h4">Custom QR Codes</h3>
<p>Generate unique QR codes with custom colors, shapes, and your own logo to bridge the physical and digital worlds.</p>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/stats/400/300" class="img-fluid mb-3" alt="Dashboard showing charts and graphs for analytics.">
<h3 class="h4">Trackable Analytics</h3>
<p>Monitor clicks, scans, and traffic with a powerful analytics dashboard to understand your audience better.</p>
</div>
</div>
</div>
</div>
</section>
</main> </main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <footer class="container py-5">
<div class="row">
<div class="col-12 col-md">
<span class="fs-5 fw-bold">LinkHub</span>
<small class="d-block mb-3 text-muted">&copy; 2025</small>
</div>
<div class="col-6 col-md">
<h5>Features</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary text-decoration-none" href="#">Link Shortening</a></li>
<li><a class="link-secondary text-decoration-none" href="#">Bio Pages</a></li>
<li><a class="link-secondary text-decoration-none" href="#">QR Codes</a></li>
<li><a class="link-secondary text-decoration-none" href="#">Analytics</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary text-decoration-none" href="#">Blog</a></li>
<li><a class="link-secondary text-decoration-none" href="#">Help Center</a></li>
<li><a class="link-secondary text-decoration-none" href="#">Privacy Policy</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>About</h5>
<ul class="list-unstyled text-small">
<li><a class="link-secondary text-decoration-none" href="#">Team</a></li>
<li><a class="link-secondary text-decoration-none" href="#">Contact Us</a></li>
</ul>
</div>
</div>
</footer> </footer>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body> </body>
</html> </html>