Refactor project

This commit is contained in:
TheAlluringCO
2025-07-10 00:21:08 +02:00
parent 6af2403497
commit bb06ed902b
11 changed files with 81 additions and 86 deletions

View File

@@ -1,21 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AI Email Generator - Result</title>
<link rel="stylesheet" href="style.css">
</head>
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/config.php');
include($_SERVER['DOCUMENT_ROOT'] . '/inc/php/header.php');
?>
<body>
<div class="container">
<?php
// Load API key from config
$config = include 'config.php';
$apikey = $config['openai_api_key'];
$apikey = getApi();
// Sanitize and validate user inputs
$emailInput = trim($_POST['email_input'] ?? '');
$tone = $_POST['tone'] ?? '';
$language = $_POST['language'] ?? 'English'; // Language selector
$tone = htmlspecialchars($_POST['tone']) ?? '';
$language = htmlspecialchars($_POST['language']) ?? 'English'; // Language selector
$allowedTones = [
'formal' => 'Write this email in a formal tone',
@@ -106,12 +103,5 @@
return false;
};
}
if (darkBtn) {
darkBtn.onclick = function () {
document.body.classList.toggle('dark-mode');
};
}
</script>
</body>
</html>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/inc/php/footer.php');