<?php
ini_set('error_reporting', 8191);
ini_set('display_errors', 1);
$baseDir = dirname(__FILE__);
// include "/bayadicbot/src/bots/loader.php";
include "./bayadicbot/src/bots/loader.php";
// Function to display the result in a structured HTML format
function displayResult($result) {
echo "<!DOCTYPE html>";
echo "<html lang='en'>";
echo "<head>";
echo "<meta charset='UTF-8'>";
echo "<meta name='viewport' content='width=device-width, initial-scale=1.0'>";
echo "<title>Translation Result</title>";
echo "<style>";
echo "body { font-family: Arial, sans-serif; margin: 20px; }";
echo ".table-wrapper { overflow-x: auto; }";
echo "table { width: 100%; border-collapse: collapse; }";
echo "th, td { padding: 10px; border: 1px solid #ddd; }";
echo "th { background-color: #f4f4f4; }";
echo "@media screen and (max-width: 600px) {";
echo " table { width: 100%; }";
echo " th, td { padding: 8px; font-size: 14px; }";
echo "}";
echo "</style>";
echo '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4065002950885098"
crossorigin="anonymous"></script>';
echo "</head>";
echo "<body>";
echo "<div class='table-wrapper'>";
echo "<table>";
echo "<tr>";
echo "<th>Word</th>";
echo "<th>Translation</th>";
echo "</tr>";
foreach ($result as $item) {
echo "<tr>";
echo "<td>" . htmlspecialchars($item['word']) . "</td>";
echo "<td>" . htmlspecialchars($item['translation']) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
echo "</body>";
echo "</html>";
}
// Check if the 'word' parameter is set in the URL
if (isset($_GET['word'])) {
// Get the word from the URL
$word = htmlspecialchars($_GET['word']);
// Process the word (e.g., look it up in a dictionary, etc.)
$BOT_USER = '@TranslateGerman_bot';
$BOT_TOKEN = "notimp";
$WEBHOOK_URL = "webhook";
$translate_bot = new TranslateGerman($BOT_USER, $BOT_TOKEN, $WEBHOOK_URL);
// $result = $translate_bot->getDB()->lookForWordInDictionary($word);
// Display the result in a structured HTML format
displayResult($result);
} else {
// If the 'word' parameter is not set, show an error or a default message
echo "No word specified.";
}
?>