Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
4c235f6179 hell yea 2025-12-01 12:52:33 +00:00
6 changed files with 269 additions and 146 deletions

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

@ -0,0 +1,41 @@
body {
background-color: #F9FAFB;
font-family: 'Inter', sans-serif;
color: #1F2937;
}
.navbar {
border-bottom: 1px solid #E5E7EB;
}
.btn-primary {
background-color: #4F46E5;
border-color: #4F46E5;
}
.btn-primary:hover {
background-color: #4338CA;
border-color: #4338CA;
}
.card {
border-radius: 0.5rem;
border: 1px solid #E5E7EB;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.form-control {
border-radius: 0.5rem;
}
.form-control:focus {
border-color: #4F46E5;
box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.25);
}
.hero {
background: linear-gradient(to right, #4F46E5, #818CF8);
padding: 4rem 0;
color: white;
}

65
create_project.php Normal file
View File

@ -0,0 +1,65 @@
<?php
session_start();
require_once 'db/config.php';
$title = '';
$description = '';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$title = trim($_POST['title'] ?? '');
$description = trim($_POST['description'] ?? '');
if (empty($title)) {
$error = 'Project title is required.';
} else {
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO projects (title, description) VALUES (?, ?)");
$stmt->execute([$title, $description]);
$_SESSION['message'] = 'Project created successfully!';
header("Location: projects.php");
exit;
} catch (PDOException $e) {
$error = "Database error: " . $e->getMessage();
}
}
}
include 'includes/header.php';
?>
<div class="container py-5">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h1 class="h3 mb-0">Create a New Project</h1>
</div>
<div class="card-body">
<?php if ($error): ?>
<div class="alert alert-danger">
<?php echo htmlspecialchars($error); ?>
</div>
<?php endif; ?>
<form action="create_project.php" method="POST">
<div class="mb-3">
<label for="title" class="form-label">Project Title</label>
<input type="text" class="form-control" id="title" name="title" value="<?php echo htmlspecialchars($title); ?>" required>
</div>
<div class="mb-3">
<label for="description" class="form-label">Project Description</label>
<textarea class="form-control" id="description" name="description" rows="5"><?php echo htmlspecialchars($description); ?></textarea>
</div>
<button type="submit" class="btn btn-primary">Create Project</button>
<a href="projects.php" class="btn btn-secondary">Cancel</a>
</form>
</div>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

10
includes/footer.php Normal file
View File

@ -0,0 +1,10 @@
<footer class="py-4 mt-auto text-center text-muted">
<div class="container">
<small>&copy; <?php echo date('Y'); ?> <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'AI Math Lectures'); ?>. All Rights Reserved.</small>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

37
includes/header.php Normal file
View File

@ -0,0 +1,37 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'AI Math Lectures'); ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<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;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'Create AI-powered math lecture videos.'); ?>">
<meta property="og:title" content="<?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'AI Math Lectures'); ?>">
<meta property="og:description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'Create AI-powered math lecture videos.'); ?>">
</head>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container">
<a class="navbar-brand" href="index.php"><?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'AI Math Lectures'); ?></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="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="projects.php">Projects</a>
</li>
</ul>
</div>
</div>
</nav>

192
index.php
View File

@ -1,150 +1,50 @@
<?php <?php
declare(strict_types=1); ini_set('display_errors', 1);
@ini_set('display_errors', '1'); ini_set('display_startup_errors', 1);
@error_reporting(E_ALL); error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION; include 'includes/header.php';
$now = date('Y-m-d H:i:s');
?> ?>
<!doctype html>
<html lang="en"> <div class="hero text-center">
<head> <div class="container">
<meta charset="utf-8" /> <h1 class="display-4">Welcome to the AI Math Lecture Creator</h1>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <p class="lead">Your platform for generating engaging math video content with the power of AI.</p>
<title>New Style</title> <a href="create_project.php" class="btn btn-primary btn-lg">Get Started</a>
<?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.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>
</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>
<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> </div>
</main> </div>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <div class="container py-5">
</footer> <div class="row text-center">
</body> <div class="col-md-4">
</html> <div class="card h-100">
<div class="card-body">
<h5 class="card-title">1. Create a Project</h5>
<p class="card-text">Start by creating a new project to house your lecture scripts, simulations, and final videos.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">2. Generate Scripts</h5>
<p class="card-text">Use our AI-powered script generator to quickly create detailed and accurate mathematical lecture scripts.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title">3. Render & Publish</h5>
<p class="card-text">Combine your scripts with simulations and generate a final video, ready to be shared with your students.</p>
</div>
</div>
</div>
</div>
<div class="text-center mt-5">
<a href="projects.php" class="btn btn-secondary">View All Projects</a>
</div>
</div>
<?php include 'includes/footer.php'; ?>

70
projects.php Normal file
View File

@ -0,0 +1,70 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
require_once 'db/config.php';
$message = '';
if (isset($_SESSION['message'])) {
$message = $_SESSION['message'];
unset($_SESSION['message']);
}
$pdo = db();
// Create table if it doesn't exist
$pdo->exec("CREATE TABLE IF NOT EXISTS projects (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);");
$stmt = $pdo->query("SELECT * FROM projects ORDER BY created_at DESC");
$projects = $stmt->fetchAll();
include 'includes/header.php';
?>
<div class="container py-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2">Projects</h1>
<a href="create_project.php" class="btn btn-primary">Create New Project</a>
</div>
<?php if ($message): ?>
<div class="alert alert-success">
<?php echo htmlspecialchars($message); ?>
</div>
<?php endif; ?>
<?php if (count($projects) > 0): ?>
<div class="row">
<?php foreach ($projects as $project): ?>
<div class="col-md-4 mb-4">
<div class="card h-100">
<div class="card-body">
<h5 class="card-title"><?php echo htmlspecialchars($project['title']); ?></h5>
<p class="card-text"><?php echo nl2br(htmlspecialchars($project['description'])); ?></p>
</div>
<div class="card-footer text-muted">
<small>Created on: <?php echo date('M d, Y', strtotime($project['created_at'])); ?></small>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="card text-center">
<div class="card-body">
<p class="card-text">No projects found. Get started by creating a new one!</p>
<a href="create_project.php" class="btn btn-primary">Create a Project</a>
</div>
</div>
<?php endif; ?>
</div>
<?php include 'includes/footer.php'; ?>