Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0381e4484b | ||
|
|
9bc81847af |
29
api/pexels.php
Normal file
29
api/pexels.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__.'/../includes/pexels.php';
|
||||
$qs = isset($_GET['queries']) ? explode(',', $_GET['queries']) : ['vibe','code','seo'];
|
||||
$out = [];
|
||||
foreach ($qs as $q) {
|
||||
$u = 'https://api.pexels.com/v1/search?query=' . urlencode(trim($q)) . '&orientation=landscape&per_page=1&page=1';
|
||||
$d = pexels_get($u);
|
||||
if ($d && !empty($d['photos'])) {
|
||||
$p = $d['photos'][0];
|
||||
$src = $p['src']['large'] ?? null;
|
||||
$dest = __DIR__.'/../assets/images/pexels/'.$p['id'].'.jpg';
|
||||
if ($src) download_to($src, $dest);
|
||||
$out[] = [
|
||||
'src' => 'assets/images/pexels/'.$p['id'].'.jpg',
|
||||
'photographer' => $p['photographer'] ?? 'Unknown',
|
||||
'photographer_url' => $p['photographer_url'] ?? '',
|
||||
];
|
||||
} else {
|
||||
// Fallback: Picsum
|
||||
$out[] = [
|
||||
'src' => 'https://picsum.photos/seed/'.urlencode(trim($q)).'/800/600',
|
||||
'photographer' => 'Random Picsum',
|
||||
'photographer_url' => 'https://picsum.photos/'
|
||||
];
|
||||
}
|
||||
}
|
||||
echo json_encode($out);
|
||||
?>
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
body {
|
||||
background-color: #F8FAFC;
|
||||
color: #0F172A;
|
||||
@ -6,13 +5,7 @@ body {
|
||||
}
|
||||
|
||||
.hero {
|
||||
background: linear-gradient(45deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
|
||||
padding: 6rem 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@ -26,6 +19,18 @@ body {
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 0.75rem;
|
||||
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
|
||||
transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.card img {
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
}
|
||||
@ -1 +1 @@
|
||||
body { font-family: "Arial", sans-serif; background-color: #f0f0f0; color: #000; } .navbar, .card, footer { background-color: #f0f0f0 !important; border: 2px solid #000; box-shadow: none !important; border-radius: 0; } .navbar-brand, .nav-link, h1, h2, h5, p { color: #000 !important; } .btn-primary { background-color: #FFFF00; color: #000; border: 2px solid #000; border-radius: 0; } .vibe-preview { padding: 2rem; border: 2px solid #000; margin-top: 2rem; }
|
||||
@import url("https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&display=swap"); body { font-family: "Roboto Slab", serif; background-color: #D2B48C; color: #333; } .navbar, .card, footer { background-color: #8B4513 !important; color: white; border: 3px solid #654321; } .navbar-brand, .nav-link, h1, h2, h5, p, .card-body { color: #fff !important; } .btn-primary { background-color: #008000; color: #fff; border: 2px solid #006400; } .vibe-preview { padding: 2rem; border: 2px solid #654321; margin-top: 2rem; background-color: #F5DEB3; } .vibe-preview h2, .vibe-preview p { color: #333 !important; }
|
||||
BIN
assets/images/pexels/1105666.jpg
Normal file
BIN
assets/images/pexels/1105666.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
assets/images/pexels/270637.jpg
Normal file
BIN
assets/images/pexels/270637.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
BIN
assets/images/pexels/34170429.jpg
Normal file
BIN
assets/images/pexels/34170429.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
BIN
assets/images/pexels/34233235.jpg
Normal file
BIN
assets/images/pexels/34233235.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
assets/images/pexels/34256624.jpg
Normal file
BIN
assets/images/pexels/34256624.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
BIN
assets/images/pexels/546819.jpg
Normal file
BIN
assets/images/pexels/546819.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
97
chat.php
97
chat.php
@ -1,97 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chat with Gemini</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
<style>
|
||||
.chat-container {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.chat-header {
|
||||
background-color: #f8f9fa;
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
.chat-box {
|
||||
height: 400px;
|
||||
overflow-y: auto;
|
||||
padding: 15px;
|
||||
}
|
||||
.chat-input {
|
||||
padding: 15px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.message {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.user-message {
|
||||
text-align: right;
|
||||
}
|
||||
.bot-message .card-body {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php include 'navbar.php'; ?>
|
||||
<div class="container">
|
||||
<div class="chat-container">
|
||||
<div class="chat-header">
|
||||
Chat with Gemini
|
||||
</div>
|
||||
<div class="chat-box" id="chat-box">
|
||||
<!-- Messages will be appended here -->
|
||||
</div>
|
||||
<div class="chat-input">
|
||||
<form id="chat-form">
|
||||
<div class="input-group">
|
||||
<input type="text" id="user-input" class="form-control" placeholder="Ask me about the app...">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="submit">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#chat-form").submit(function(e) {
|
||||
e.preventDefault();
|
||||
var userInput = $("#user-input").val();
|
||||
if (userInput.trim() === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Display user message
|
||||
$("#chat-box").append('<div class="message user-message"><div class="card d-inline-block"><div class="card-body">' + userInput + '</div></div></div>');
|
||||
$("#user-input").val("");
|
||||
$("#chat-box").scrollTop($("#chat-box")[0].scrollHeight);
|
||||
|
||||
|
||||
// Send user input to the bot
|
||||
$.ajax({
|
||||
url: "chat_logic.php",
|
||||
type: "POST",
|
||||
data: { message: userInput },
|
||||
success: function(response) {
|
||||
// Display bot response
|
||||
$("#chat-box").append('<div class="message bot-message"><div class="card d-inline-block"><div class="card-body">' + response + '</div></div></div>');
|
||||
$("#chat-box").scrollTop($("#chat-box")[0].scrollHeight);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
$message = strtolower($_POST['message'] ?? '');
|
||||
|
||||
if (str_contains($message, 'hello') || str_contains($message, 'hi')) {
|
||||
echo "Hello! I'm Gemini, your in-app assistant. Ask me anything about this application.";
|
||||
} elseif (str_contains($message, 'vibe')) {
|
||||
echo "The 'Vibe Generator' (`vibe.php`) lets you generate random color palettes and CSS gradients. You can even save and share your favorite themes.";
|
||||
} elseif (str_contains($message, 'seo')) {
|
||||
echo "The 'SEO Checker' (`seo.php`) analyzes the on-page SEO of a given URL. It checks for title tags, meta descriptions, headings, and more.";
|
||||
} elseif (str_contains($message, 'sandbox')) {
|
||||
echo "The 'PHP Sandbox' (`sandbox.php`) is a safe environment where you can execute arbitrary PHP code and see the output.";
|
||||
} elseif (str_contains($message, 'contact')) {
|
||||
echo "The 'Contact' page (`contact.php`) contains a form that allows you to send an email using the app's built-in mail service.";
|
||||
} elseif (str_contains($message, 'admin')) {
|
||||
echo "The 'Admin' page (`admin.php`) is for managing the 'Nokia Facts'. It's a full CRUD interface for creating, reading, updating, and deleting facts.";
|
||||
} elseif (str_contains($message, 'chat')) {
|
||||
echo "This is the 'Chat' page (`chat.php`). You're talking to me right now! I can tell you about the different features of this application.";
|
||||
} elseif (str_contains($message, 'home') || str_contains($message, 'index')) {
|
||||
echo "The 'Home' page (`index.php`) is the main landing page of the application.";
|
||||
} else {
|
||||
echo "I'm sorry, I don't have information about that. I can answer questions about the Vibe Generator, SEO Checker, PHP Sandbox, Contact Form, Admin page, and the Chat feature.";
|
||||
}
|
||||
26
includes/pexels.php
Normal file
26
includes/pexels.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
function pexels_key() {
|
||||
$k = getenv('PEXELS_KEY');
|
||||
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
|
||||
}
|
||||
function pexels_get($url) {
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
]);
|
||||
$resp = curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
|
||||
return null;
|
||||
}
|
||||
function download_to($srcUrl, $destPath) {
|
||||
$data = file_get_contents($srcUrl);
|
||||
if ($data === false) return false;
|
||||
if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true);
|
||||
return file_put_contents($destPath, $data) !== false;
|
||||
}
|
||||
?>
|
||||
37
index.php
37
index.php
@ -14,10 +14,10 @@
|
||||
<?php include 'navbar.php'; ?>
|
||||
|
||||
<main>
|
||||
<section class="hero">
|
||||
<section class="hero text-center">
|
||||
<div class="container">
|
||||
<h1 class="display-4">Generate a Website With a Vibe</h1>
|
||||
<p class="lead col-lg-8 mx-auto">Tell our AI your vibe, and we'll spin up a micro-site in seconds. From Synthwave to Brutalism, discover your digital aesthetic.</p>
|
||||
<h1 class="display-3 fw-bold">Generate a Website With a Vibe</h1>
|
||||
<p class="lead col-lg-8 mx-auto text-muted">Tell our AI your vibe, and we'll spin up a micro-site in seconds. From Synthwave to Brutalism, discover your digital aesthetic.</p>
|
||||
<a href="vibe.php" class="btn btn-primary btn-lg px-4">
|
||||
<i class="bi bi-stars"></i>
|
||||
Create a Vibe Site
|
||||
@ -25,12 +25,12 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="py-5">
|
||||
<section class="py-5 bg-light">
|
||||
<div class="container">
|
||||
<div class="row text-center g-4">
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 p-4">
|
||||
<img src="https://picsum.photos/seed/lamp-vibe/800/600" class="card-img-top rounded mb-3" alt="A colorful, abstract image representing different design vibes.">
|
||||
<img id="img-vibe" src="https://picsum.photos/seed/lamp-vibe/800/600" class="card-img-top rounded mb-3" alt="A colorful, abstract image representing different design vibes.">
|
||||
<div class="card-body">
|
||||
<h3 class="h4">Vibe Generator</h3>
|
||||
<p>Choose a vibe, give us a keyword, and watch the magic happen. Your own micro-site, generated by AI.</p>
|
||||
@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 p-4">
|
||||
<img src="https://picsum.photos/seed/lamp-code/800/600" class="card-img-top rounded mb-3" alt="A snippet of code on a dark background, representing the PHP sandbox.">
|
||||
<img id="img-code" src="https://picsum.photos/seed/lamp-code/800/600" class="card-img-top rounded mb-3" alt="A snippet of code on a dark background, representing the PHP sandbox.">
|
||||
<div class="card-body">
|
||||
<h3 class="h4">PHP Sandbox</h3>
|
||||
<p>Safely run PHP code snippets in an isolated environment. Perfect for testing and learning.</p>
|
||||
@ -48,7 +48,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 p-4">
|
||||
<img src="https://picsum.photos/seed/lamp-seo/800/600" class="card-img-top rounded mb-3" alt="A magnifying glass over a web page, symbolizing SEO analysis.">
|
||||
<img id="img-seo" src="https://picsum.photos/seed/lamp-seo/800/600" class="card-img-top rounded mb-3" alt="A magnifying glass over a web page, symbolizing SEO analysis.">
|
||||
<div class="card-body">
|
||||
<h3 class="h4">SEO Checker</h3>
|
||||
<p>Paste your HTML and get instant feedback on your on-page SEO, powered by AI analysis.</p>
|
||||
@ -60,13 +60,32 @@
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer class="py-4 mt-auto bg-light">
|
||||
<footer class="py-5 bg-dark text-white">
|
||||
<div class="container text-center">
|
||||
<p class="mb-0 text-muted">© <?php echo date("Y"); ?> Flatlogic. All rights reserved.</p>
|
||||
<p class="mb-0">© <?php echo date("Y"); ?> Flatlogic. All rights reserved.</p>
|
||||
<p class="mb-0">
|
||||
<a href="contact.php" class="text-white">Contact</a> |
|
||||
<a href="#" class="text-white">Privacy Policy</a> |
|
||||
<a href="#" class="text-white">Terms of Service</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<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>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
fetch('api/pexels.php?queries=vibe,code,seo')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data && data.length === 3) {
|
||||
document.getElementById('img-vibe').src = data[0].src;
|
||||
document.getElementById('img-code').src = data[1].src;
|
||||
document.getElementById('img-seo').src = data[2].src;
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error fetching images:', error));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,4 +1,4 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="index.php">Flatlogic</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
@ -21,9 +21,7 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="contact.php">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="chat.php">Chat</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="admin.php">Admin</a>
|
||||
</li>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user