Refactor project
This commit is contained in:
28
process.php
28
process.php
@@ -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');
|
||||
Reference in New Issue
Block a user