Auto commit: 2025-10-05T17:44:42.404Z

This commit is contained in:
Flatlogic Bot 2025-10-05 17:44:42 +00:00
parent 6decd3c147
commit 923befa860
20 changed files with 1171 additions and 141 deletions

163
actions.php Normal file
View File

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Log Your Action - Chirivia</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 {
--primary-green: #2E8B57;
--secondary-blue: #4682B4;
--accent-color: #5F9EA0;
--background-light: #F0F8FF;
--surface-white: #FFFFFF;
--text-dark: #2F4F4F;
--font-headings: 'Inter', sans-serif;
--font-body: 'Inter', sans-serif;
--spacing-base: 8px;
--border-radius: 0.5rem; /* 8px */
--danger-red: #DC3545;
--neutral-gray: #A9A9A9;
}
body {
font-family: var(--font-body);
line-height: 1.6;
margin: 0;
padding: 0;
background-color: var(--background-light);
color: var(--text-dark);
display: flex;
flex-direction: column;
min-height: 100vh;
}
.header {
background: var(--surface-white);
padding: 1rem 2rem;
border-bottom: 1px solid #E0E0E0;
display: flex;
justify-content: space-between;
align-items: center;
}
.header .logo {
font-family: var(--font-headings);
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-green);
text-decoration: none;
}
.main {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
padding: 2rem;
}
.action-container {
background: var(--surface-white);
padding: 2rem;
border-radius: var(--border-radius);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
text-align: center;
max-width: 500px;
width: 100%;
}
h1 {
font-family: var(--font-headings);
color: var(--primary-green);
margin-bottom: 1.5rem;
}
.message {
font-size: 1.2rem;
margin-bottom: 2rem;
}
.form-container form {
display: flex;
justify-content: center;
gap: 1rem;
}
.btn {
font-family: var(--font-body);
padding: 0.75rem 1.5rem;
border: none;
border-radius: var(--border-radius);
font-size: 1rem;
cursor: pointer;
text-decoration: none;
display: inline-block;
color: var(--surface-white);
}
.btn-yes {
background-color: var(--primary-green);
}
.btn-no {
background-color: var(--neutral-gray);
}
.result-message {
margin-top: 2rem;
font-size: 1.2rem;
font-weight: bold;
}
.result-message .chick {
font-size: 2rem;
}
.footer {
text-align: center;
padding: 1.5rem;
background: var(--surface-white);
border-top: 1px solid #E0E0E0;
font-size: 0.9rem;
color: #6c757d;
}
</style>
</head>
<body>
<header class="header">
<a href="index.php" class="logo">Chirivia</a>
</header>
<main class="main">
<div class="action-container">
<h1>Log Your Green Action</h1>
<?php
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['answer'])) {
$answer = $_POST['answer'];
if ($answer === 'yes') {
$message = '<div class="chick">🐣</div> says thank you!';
} elseif ($answer === 'no') {
$message = '<div class="chick">🐣</div> says you should go do it asap!';
}
}
?>
<?php if ($message): ?>
<div class="result-message">
<?php echo $message; ?>
<br><br>
<a href="actions.php" class="btn btn-yes">Log another action</a>
</div>
<?php else: ?>
<p class="message">Did you do something good for the environment today?</p>
<div class="form-container">
<form method="POST" action="actions.php">
<button type="submit" name="answer" value="yes" class="btn btn-yes">Yes, I did!</button>
<button type="submit" name="answer" value="no" class="btn btn-no">Not yet</button>
</form>
</div>
<?php endif; ?>
</div>
</main>
<footer class="footer">
<p>&copy; <?php echo date("Y"); ?> Chirivia. All rights reserved. | <a href="privacy.php">Privacy Policy</a></p>
</footer>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

1
gcp_creds/.htaccess Normal file
View File

@ -0,0 +1 @@
Deny from all

481
index.php
View File

@ -1,150 +1,421 @@
<?php <?php
declare(strict_types=1); session_start();
@ini_set('display_errors', '1'); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
@error_reporting(E_ALL); header("Cache-Control: post-check=0, pre-check=0", false);
@date_default_timezone_set('UTC'); header("Pragma: no-cache");
$phpVersion = PHP_VERSION; if (!isset($_SESSION['streak'])) {
$now = date('Y-m-d H:i:s'); $_SESSION['streak'] = 0;
}
?> ?>
<!doctype html> <!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>Chirivia - Save the Planet, Save Your Chircuit</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<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=Inter:wght@400;700&display=swap" rel="stylesheet">
<style> <style>
:root { :root {
--bg-color-start: #6a11cb; --primary-green: #2E8B57;
--bg-color-end: #2575fc; --secondary-blue: #4682B4;
--text-color: #ffffff; --accent-color: #5F9EA0;
--card-bg-color: rgba(255, 255, 255, 0.01); --background-light: #F0F8FF;
--card-border-color: rgba(255, 255, 255, 0.1); --surface-white: #FFFFFF;
--text-dark: #2F4F4F;
--font-headings: 'Inter', sans-serif;
--font-body: 'Inter', sans-serif;
--spacing-base: 8px;
--border-radius: 0.5rem; /* 8px */
} }
body { body {
font-family: var(--font-body);
background-color: var(--background-light);
color: var(--text-dark);
margin: 0; margin: 0;
font-family: 'Inter', sans-serif; line-height: 1.6;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); }
color: var(--text-color);
display: flex; .container {
justify-content: center; max-width: 960px;
align-items: center; margin: 0 auto;
min-height: 100vh; padding: calc(var(--spacing-base) * 2);
}
h1, h2, h3 {
font-family: var(--font-headings);
color: var(--primary-green);
}
.header {
background: var(--surface-white);
padding: calc(var(--spacing-base) * 2) 0;
border-bottom: 1px solid #eee;
text-align: center; text-align: center;
overflow: hidden; }
.header .logo {
font-family: var(--font-headings);
font-size: 2rem;
color: var(--primary-green);
text-decoration: none;
font-weight: bold;
}
.hero {
background: linear-gradient(135deg, var(--primary-green), var(--secondary-blue));
color: var(--surface-white);
padding: calc(var(--spacing-base) * 8) calc(var(--spacing-base) * 2);
text-align: center;
background-image: url('assets/pasted-20251004-214642-63e1d23c.webp');
background-size: 100% auto;
background-repeat: no-repeat;
background-position: center 25%;
position: relative; position: relative;
} }
body::before {
.hero::before {
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
}
.hero-content {
position: relative;
z-index: 1;
}
.hero h1 {
font-size: 4rem;
margin-bottom: var(--spacing-base);
color: var(--surface-white);
}
.hero p {
font-size: 1.25rem;
margin-bottom: calc(var(--spacing-base) * 3);
}
.cta-button {
background-color: var(--accent-color);
color: var(--surface-white);
padding: calc(var(--spacing-base) * 1.5) calc(var(--spacing-base) * 3);
border: none;
border-radius: var(--border-radius);
font-size: 1.1rem;
font-weight: bold;
text-decoration: none;
cursor: pointer;
transition: background-color 0.3s ease;
}
.cta-button:hover {
background-color: #53868B;
}
.section {
padding: calc(var(--spacing-base) * 6) 0;
border-bottom: 1px solid #eee;
}
.section:last-child {
border-bottom: none;
}
.pet-section {
display: flex;
align-items: center;
gap: calc(var(--spacing-base) * 4);
}
.pet-section .pet-image-frame {
width: 300px;
height: 300px;
border-radius: 50%;
overflow: hidden;
border: 5px solid var(--surface-white);
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.pet-section img {
width: 100%; width: 100%;
height: 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>'); object-fit: cover;
animation: bg-pan 20s linear infinite; transform: scale(1.2);
z-index: -1;
} }
@keyframes bg-pan {
0% { background-position: 0% 0%; } .pet-status h2 {
100% { background-position: 100% 100%; } margin-top: 0;
font-size: 2.5rem;
margin-bottom: 0;
} }
main {
padding: 2rem; .streak-counter {
font-size: 1.5rem;
font-weight: bold;
color: var(--secondary-blue);
} }
.card {
background: var(--card-bg-color); .about-section h2 {
border: 1px solid var(--card-border-color); font-size: 2.5rem;
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; .about-section {
width: 48px; display: flex;
height: 48px; align-items: center;
border: 3px solid rgba(255, 255, 255, 0.25); gap: calc(var(--spacing-base) * 4);
border-top-color: #fff; }
.about-section img {
max-width: 400px;
border-radius: var(--border-radius);
}
.footer {
background-color: var(--surface-white);
text-align: center;
padding: calc(var(--spacing-base) * 3) 0;
margin-top: calc(var(--spacing-base) * 4);
font-size: 0.9rem;
}
.footer a {
color: var(--primary-green);
text-decoration: none;
}
@keyframes float {
0% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
100% {
transform: translateY(0px);
}
}
.animated-pet {
animation: float 3s ease-in-out infinite;
}
.pet-image-frame img {
position: absolute;
top: 0;
left: 0;
opacity: 0;
transition: opacity 1s ease-in-out;
}
.pet-image-frame img.active {
opacity: 1;
}
/* Chat Widget */
.chat-widget-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
.chat-bubble {
width: 60px;
height: 60px;
background-color: var(--secondary-blue);
border-radius: 50%; border-radius: 50%;
animation: spin 1s linear infinite; display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
transition: transform 0.2s;
} }
@keyframes spin { .chat-bubble:hover {
from { transform: rotate(0deg); } transform: scale(1.1);
to { transform: rotate(360deg); }
} }
.hint { .chat-window {
opacity: 0.9; display: none;
}
.sr-only {
position: absolute; position: absolute;
width: 1px; height: 1px; bottom: 80px;
padding: 0; margin: -1px; right: 0;
overflow: hidden; width: 350px;
clip: rect(0, 0, 0, 0); max-width: 90vw;
white-space: nowrap; border: 0; background: #fff;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
flex-direction: column;
} }
h1 { .chat-header {
font-size: 3rem; background: var(--secondary-blue);
font-weight: 700; color: white;
margin: 0 0 1rem; padding: 15px;
letter-spacing: -1px; border-top-left-radius: 10px;
border-top-right-radius: 10px;
display: flex;
justify-content: space-between;
align-items: center;
} }
p { .chat-header p {
margin: 0.5rem 0; margin: 0;
font-size: 1.1rem; font-weight: bold;
} }
code { .close-chat {
background: rgba(0,0,0,0.2); cursor: pointer;
padding: 2px 6px; font-size: 24px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
} }
footer { .chat-body {
position: absolute; padding: 15px;
bottom: 1rem; height: 300px;
font-size: 0.8rem; overflow-y: auto;
opacity: 0.7; background: #f9f9f9;
} }
.message {
margin-bottom: 15px;
}
.message p {
background: #e9e9eb;
padding: 10px 15px;
border-radius: 15px;
display: inline-block;
max-width: 80%;
margin: 0;
}
.chat-footer {
padding: 15px;
display: flex;
border-top: 1px solid #ddd;
}
.chat-footer input {
flex: 1;
border: 1px solid #ddd;
border-radius: 20px;
padding: 10px;
margin-right: 10px;
}
.chat-footer button {
background: var(--secondary-blue);
color: white;
border: none;
padding: 10px 20px;
border-radius: 20px;
cursor: pointer;
}
.cta-button img {
}
</style> </style>
</head> </head>
<body> <body>
<main> <main>
<div class="card"> <section class="hero">
<h1>Analyzing your requirements and generating your website…</h1> <div class="hero-content">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <h1>Chirivia</h1>
<span class="sr-only">Loading…</span> <p>Save the Planet, Save Your Chircuit.</p>
</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> <div style="text-align: center; padding: 24px 0; background-color: var(--background-light); border-bottom: 1px solid #eee;">
<a href="quiz.php?v=<?php echo time(); ?>" class="cta-button" style="margin-right: 16px;">Play Trivia</a>
<a href="actions.php?v=<?php echo time(); ?>" class="cta-button" style="margin-right: 16px;">Log an Action</a>
<a href="streaks.php?v=<?php echo time(); ?>" class="cta-button">Streaks</a>
</div>
<div class="container">
<section class="section pet-section">
<div class="pet-image-frame animated-pet" style="position: relative;">
<img src="assets/pasted-20251004-192255-8c7c39e6.webp" alt="A cute, healthy pet chircuit." class="active">
<img src="assets/pasted-20251004-222033-3b718197.webp" alt="A happy, playful pet chircuit.">
</div>
<div class="pet-status">
<h2>Your Pet Chircuit</h2>
<p>Keep me alive by learning about our planet!</p>
<div class="streak-counter">
🔥 Streak: <?php echo $_SESSION['streak']; ?> <?php echo ($_SESSION['streak'] == 1) ? 'day' : 'days'; ?> 🔥
</div>
</div>
</section>
<section class="section about-section">
<div>
<h2>About Chirivia</h2>
<p>Chirivia makes learning about environmental issues fun and engaging. Every correct answer helps you maintain your streak and contributes to a (virtual) healthier planet, keeping your pet happy and healthy.</p>
<p>You can also log real-world actions to get extra points!</p>
</div>
<img src="https://picsum.photos/seed/about/800/600" alt="A person planting a small tree, symbolizing environmental action.">
</section>
</div> </div>
</main> </main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <footer class="footer">
<div class="container">
<p>&copy; 2025 Chirivia. All Rights Reserved. | <a href="privacy.php">Privacy Policy</a></p>
</div>
</footer> </footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const petImageFrame = document.querySelector('.pet-image-frame');
const images = petImageFrame.querySelectorAll('img');
let currentIndex = 0;
setInterval(() => {
images[currentIndex].classList.remove('active');
currentIndex = (currentIndex + 1) % images.length;
images[currentIndex].classList.add('active');
}, 3000); // Change image every 3 seconds
});
</script>
<!-- Chat Widget -->
<div class="chat-widget-container">
<div id="chat-bubble" class="chat-bubble">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/></svg>
</div>
<div id="chat-window" class="chat-window">
<div class="chat-header">
<p>Chat with us!</p>
<span id="close-chat" class="close-chat">&times;</span>
</div>
<div class="chat-body">
<div class="message received">
<p>Hi there! How can I help you today?</p>
</div>
</div>
<div class="chat-footer">
<input type="text" placeholder="Type a message...">
<button>Send</button>
</div>
</div>
</div>
<script>
const chatBubble = document.getElementById('chat-bubble');
const chatWindow = document.getElementById('chat-window');
const closeChat = document.getElementById('close-chat');
chatBubble.addEventListener('click', () => {
chatWindow.style.display = 'flex';
chatBubble.style.display = 'none';
});
closeChat.addEventListener('click', () => {
chatWindow.style.display = 'none';
chatBubble.style.display = 'flex';
});
</script>
</body> </body>
</html> </html>

51
privacy.php Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Privacy Policy - Chirivia</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 {
--primary-green: #2E8B57;
--secondary-blue: #4682B4;
--accent-color: #5F9EA0;
--background-light: #F0F8FF;
--surface-white: #FFFFFF;
--text-dark: #2F4F4F;
--font-headings: 'Inter', sans-serif;
--font-body: 'Inter', sans-serif;
--spacing-base: 8px;
--border-radius: 0.5rem;
}
body {
font-family: var(--font-body);
background-color: var(--background-light);
color: var(--text-dark);
margin: 0;
line-height: 1.6;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: calc(var(--spacing-base) * 4);
}
h1 {
color: var(--primary-green);
}
a {
color: var(--primary-green);
}
</style>
</head>
<body>
<div class="container">
<h1>Privacy Policy</h1>
<p>This is a placeholder for the Privacy Policy.</p>
<p>Information about how user data is collected, used, and protected will be detailed here.</p>
<a href="index.php">Back to Home</a>
</div>
</body>
</html>

366
quiz.php Normal file
View File

@ -0,0 +1,366 @@
<?php
session_start();
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (!isset($_SESSION['streak'])) {
$_SESSION['streak'] = 0;
}
$questions = [
[
'question' => 'What is the impact of climate change on the planet?',
'options' => [
'Rising sea levels',
'More natural disasters',
'Increased temperatures globally',
'All of the above'
],
'answer' => 'All of the above'
],
[
'question' => 'Heat waves enter the atmosphere and are trapped because of the thick layer of gases that surround the planet. This is called…',
'options' => [
'Thick Atmosphere Effect',
'Greenhouse Effect',
'Increasing Heat Effect',
'None of the above'
],
'answer' => 'Greenhouse Effect'
],
[
'question' => 'When did climate change begin?',
'options' => [
'When the Industrial Revolution began',
'When the world population was larger than two billion people',
'It always has existed',
'Yesterday!'
],
'answer' => ['When the Industrial Revolution began', 'It always has existed']
]
];
$question_index = isset($_GET['q']) ? (int)$_GET['q'] : 0;
if ($question_index === 0) {
unset($_SESSION['quiz_completed_reward']);
}
$feedback = '';
if (isset($_POST['answer'])) {
$selected_answer = $_POST['answer'];
$correct_answer = $questions[$question_index]['answer'];
$is_correct = false;
if (is_array($correct_answer)) {
if (in_array($selected_answer, $correct_answer)) {
$is_correct = true;
}
} else {
if ($selected_answer == $correct_answer) {
$is_correct = true;
}
}
if ($is_correct) {
$feedback = '<div class="feedback correct" style="padding: 0;"><p style="padding: 16px 16px 0; margin: 0;">Correct! Great job.</p><img src="assets/pasted-20251004-232406-9a846679.png" alt="Happy Chircuit" class="feedback-image"></div>';
$question_index++;
} else {
$_SESSION['streak'] = 0;
$feedback = '<div class="feedback incorrect">Not quite! Try again.<br><img src="assets/pasted-20251005-145045-e02a01f3.png" alt="Sad Chircuit" class="feedback-image-incorrect"></div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trivia Quiz - Chirivia</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 {
--primary-green: #2E8B57;
--secondary-blue: #4682B4;
--accent-color: #5F9EA0;
--background-light: #F0F8FF;
--surface-white: #FFFFFF;
--text-dark: #2F4F4F;
--font-headings: 'Inter', sans-serif;
--font-body: 'Inter', sans-serif;
--spacing-base: 8px;
--border-radius: 0.5rem;
}
body {
font-family: var(--font-body);
background-color: var(--background-light);
color: var(--text-dark);
margin: 0;
line-height: 1.6;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.quiz-container {
background: var(--surface-white);
padding: calc(var(--spacing-base) * 4);
border-radius: var(--border-radius);
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
width: 100%;
max-width: 600px;
text-align: center;
}
h1 {
font-family: var(--font-headings);
color: var(--primary-green);
}
.question {
font-size: 1.25rem;
margin-bottom: calc(var(--spacing-base) * 2);
}
.options {
display: flex;
flex-direction: column;
gap: var(--spacing-base);
margin-bottom: calc(var(--spacing-base) * 3);
}
.option-button {
background-color: #eee;
border: 2px solid #ddd;
padding: calc(var(--spacing-base) * 1.5);
border-radius: var(--border-radius);
cursor: pointer;
transition: all 0.2s ease;
width: 100%;
font-size: 1rem;
}
.option-button:hover {
background-color: #ddd;
border-color: #ccc;
}
.feedback {
padding: calc(var(--spacing-base) * 2);
border-radius: var(--border-radius);
margin-top: calc(var(--spacing-base) * 2);
margin-bottom: 20px;
font-weight: bold;
}
.feedback.correct {
background-color: #d4edda;
color: #155724;
}
.feedback.incorrect {
background-color: #E0E0E0;
color: #2F4F4F;
}
.next-button {
background-color: var(--accent-color);
color: var(--surface-white);
padding: calc(var(--spacing-base) * 1.5) calc(var(--spacing-base) * 3);
border: none;
border-radius: var(--border-radius);
font-size: 1.1rem;
font-weight: bold;
text-decoration: none;
cursor: pointer;
transition: background-color 0.3s ease;
}
a {
color: var(--primary-green);
display: inline-block;
margin-top: calc(var(--spacing-base) * 2);
}
.feedback-image {
max-width: 200px;
display: block;
margin: 10px auto;
}
.feedback-image-incorrect {
max-width: 100px;
display: block;
margin: 10px auto;
}
/* Chat Widget */
.chat-widget-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
.chat-bubble {
width: 60px;
height: 60px;
background-color: var(--secondary-blue);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
transition: transform 0.2s;
}
.chat-bubble:hover {
transform: scale(1.1);
}
.chat-window {
display: none;
position: absolute;
bottom: 80px;
right: 0;
width: 350px;
max-width: 90vw;
background: #fff;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
flex-direction: column;
}
.chat-header {
background: var(--secondary-blue);
color: white;
padding: 15px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.chat-header p {
margin: 0;
font-weight: bold;
}
.close-chat {
cursor: pointer;
font-size: 24px;
}
.chat-body {
padding: 15px;
height: 300px;
overflow-y: auto;
background: #f9f9f9;
}
.message {
margin-bottom: 15px;
}
.message p {
background: #e9e9eb;
padding: 10px 15px;
border-radius: 15px;
display: inline-block;
max-width: 80%;
margin: 0;
}
.chat-footer {
padding: 15px;
display: flex;
border-top: 1px solid #ddd;
}
.chat-footer input {
flex: 1;
border: 1px solid #ddd;
border-radius: 20px;
padding: 10px;
margin-right: 10px;
}
.chat-footer button {
background: var(--secondary-blue);
color: white;
border: none;
padding: 10px 20px;
border-radius: 20px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="quiz-container">
<h1>Trivia Quiz</h1>
<?php if ($question_index < count($questions)) {
$current_question = $questions[$question_index];
?>
<p class="question"><?php echo $current_question['question']; ?></p>
<?php echo $feedback; ?>
<form method="POST" action="quiz.php?q=<?php echo $question_index; ?>">
<div class="options">
<?php foreach ($current_question['options'] as $option) { ?>
<button type="submit" name="answer" value="<?php echo htmlspecialchars($option); ?>" class="option-button"><?php echo htmlspecialchars($option); ?></button>
<?php } ?>
</div>
</form>
<?php
} else {
if (!isset($_SESSION['quiz_completed_reward'])) {
$_SESSION['streak']++;
$_SESSION['quiz_completed_reward'] = true;
}
?>
<h2>Quiz Complete!</h2>
<p>You've answered all the questions! Your streak is now <?php echo $_SESSION['streak']; ?>!</p>
<div id="animation-container" style="position: relative; width: 200px; height: 200px; margin: 20px auto;">
<img src="assets/pasted-20251005-003819-6e811280.png" alt="Chircuit with a strawberry" class="anim-image" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 1; transition: opacity 0.5s ease-in-out;">
<img src="assets/pasted-20251005-003524-d4bed2e1.png" alt="Chircuit eating a strawberry" class="anim-image" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.5s ease-in-out;">
<img src="assets/pasted-20251005-004414-8785f3f1.png" alt="Happy Chircuit" class="anim-image" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.5s ease-in-out;">
</div>
<a href="index.php" class="next-button" style="margin-top: 20px;">Back to Home</a>
<?php } ?>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const images = document.querySelectorAll('#animation-container .anim-image');
if (images.length > 0) {
let currentIndex = 0;
setInterval(() => {
images[currentIndex].style.opacity = 0;
currentIndex = (currentIndex + 1) % images.length;
images[currentIndex].style.opacity = 1;
}, 2000);
}
});
</script>
<!-- Chat Widget -->
<div class="chat-widget-container">
<div id="chat-bubble" class="chat-bubble">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/></svg>
</div>
<div id="chat-window" class="chat-window">
<div class="chat-header">
<p>Chat with us!</p>
<span id="close-chat" class="close-chat">&times;</span>
</div>
<div class="chat-body">
<div class="message received">
<p>Hi there! How can I help you today?</p>
</div>
</div>
<div class="chat-footer">
<input type="text" placeholder="Type a message...">
<button>Send</button>
</div>
</div>
</div>
<script>
const chatBubble = document.getElementById('chat-bubble');
const chatWindow = document.getElementById('chat-window');
const closeChat = document.getElementById('close-chat');
chatBubble.addEventListener('click', () => {
chatWindow.style.display = 'flex';
chatBubble.style.display = 'none';
});
closeChat.addEventListener('click', () => {
chatWindow.style.display = 'none';
chatBubble.style.display = 'flex';
});
</script>
</body>
</html>

178
streaks.php Normal file
View File

@ -0,0 +1,178 @@
<?php
session_start();
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (!isset($_SESSION['streak'])) {
$_SESSION['streak'] = 0;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Streaks - Chirivia</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 {
--primary-green: #2E8B57;
--secondary-blue: #4682B4;
--accent-color: #5F9EA0;
--background-light: #F0F8FF;
--surface-white: #FFFFFF;
--text-dark: #2F4F4F;
--font-headings: 'Inter', sans-serif;
--font-body: 'Inter', sans-serif;
--spacing-base: 8px;
--border-radius: 0.5rem; /* 8px */
}
body {
font-family: var(--font-body);
background-color: var(--background-light);
color: var(--text-dark);
margin: 0;
line-height: 1.6;
display: flex;
flex-direction: column;
min-height: 100vh;
}
.container {
max-width: 960px;
margin: 0 auto;
padding: calc(var(--spacing-base) * 2);
}
h1, h2, h3 {
font-family: var(--font-headings);
color: var(--primary-green);
}
.header {
background: var(--surface-white);
padding: calc(var(--spacing-base) * 2) 0;
border-bottom: 1px solid #eee;
text-align: center;
}
.header .logo {
font-family: var(--font-headings);
font-size: 2rem;
color: var(--primary-green);
text-decoration: none;
font-weight: bold;
}
main {
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
}
.content-wrapper {
display: flex;
align-items: center;
gap: calc(var(--spacing-base) * 8);
}
.image-container {
flex-shrink: 0;
}
.streak-image {
width: 250px;
height: 250px;
border-radius: 50%;
object-fit: contain;
background-color: var(--surface-white);
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
border: 5px solid var(--surface-white);
animation: bob 3s ease-in-out infinite;
}
.text-container {
text-align: left;
}
@keyframes bob {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-15px);
}
100% {
transform: translateY(0);
}
}
.footer {
background-color: var(--surface-white);
text-align: center;
padding: calc(var(--spacing-base) * 3) 0;
margin-top: auto;
font-size: 0.9rem;
}
.footer a {
color: var(--primary-green);
text-decoration: none;
}
.cta-button {
background-color: var(--accent-color);
color: var(--surface-white);
padding: calc(var(--spacing-base) * 1.5) calc(var(--spacing-base) * 3);
border: none;
border-radius: var(--border-radius);
font-size: 1.1rem;
font-weight: bold;
text-decoration: none;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: calc(var(--spacing-base) * 2);
display: inline-block;
}
.cta-button:hover {
background-color: #53868B;
}
</style>
</head>
<body>
<header class="header">
<div class="container">
<a href="index.php" class="logo">Chirivia</a>
</div>
</header>
<main class="container">
<div class="content-wrapper">
<div class="image-container">
<img src="assets/pasted-20251005-170401-70cc8986.png" alt="Streaks Calendar" class="streak-image">
</div>
<div class="text-container">
<h1>Track Your Progress</h1>
<p>Your commitment to learning and taking action creates a powerful impact. Keep the momentum going!</p>
<p style="font-size: 1.5rem; font-weight: bold; color: var(--secondary-blue);">
🔥 Current Streak: <?php echo $_SESSION['streak']; ?> <?php echo ($_SESSION['streak'] == 1) ? 'day' : 'days'; ?> 🔥
</p>
<a href="index.php" class="cta-button">Back to Home</a>
</div>
</div>
</main>
<footer class="footer">
<div class="container">
<p>&copy; 2025 Chirivia. All Rights Reserved. | <a href="privacy.php">Privacy Policy</a></p>
</div>
</footer>
</body>
</html>