index.php aktualisiert
This commit is contained in:
146
index.php
146
index.php
@ -7,7 +7,7 @@
|
|||||||
<style>
|
<style>
|
||||||
/* CSS aus der Mehrwertsteuerrechner-Datei */
|
/* CSS aus der Mehrwertsteuerrechner-Datei */
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif; /* Arial als Standardschriftart */
|
||||||
background-color: #fff; /* Weißer Hintergrund */
|
background-color: #fff; /* Weißer Hintergrund */
|
||||||
color: #333;
|
color: #333;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
@ -141,6 +141,43 @@
|
|||||||
footer a:hover {
|
footer a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Drag & Drop Feld CSS */
|
||||||
|
.drop-area {
|
||||||
|
border: 3px dashed #a81212;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 40px 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: #777;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s ease, border-color 0.3s ease;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.drop-area.highlight {
|
||||||
|
background-color: #fff0f0;
|
||||||
|
border-color: #dc3545;
|
||||||
|
}
|
||||||
|
.drop-area p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.drop-area input[type="file"] {
|
||||||
|
display: none; /* Verstecke das ursprüngliche Dateiauswahlfeld */
|
||||||
|
}
|
||||||
|
.file-name-display {
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 1em;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
/* Optional: Dateiname direkt unter dem Drag&Drop Feld */
|
||||||
|
#selectedFileName {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #a81212;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -154,9 +191,14 @@
|
|||||||
$result = json_decode(base64_decode($_GET['result']), true);
|
$result = json_decode(base64_decode($_GET['result']), true);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
// Zurück-Button ganz oben vor den Ergebnissen
|
||||||
|
echo '<div class="form-group" style="margin-bottom: 20px;">';
|
||||||
|
echo '<a href="index.php" class="back-button">Neue Analyse starten</a>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div class="result-section">';
|
echo '<div class="result-section">';
|
||||||
|
|
||||||
// Phishing Tendenz Anzeige ganz oben
|
// Phishing Tendenz Anzeige
|
||||||
$tendencyClass = $result['is_phishing_tendency'] ? 'red' : 'green';
|
$tendencyClass = $result['is_phishing_tendency'] ? 'red' : 'green';
|
||||||
$tendencyText = $result['is_phishing_tendency'] ? 'Phishing-Tendenz: HOCH' : 'Phishing-Tendenz: GERING';
|
$tendencyText = $result['is_phishing_tendency'] ? 'Phishing-Tendenz: HOCH' : 'Phishing-Tendenz: GERING';
|
||||||
echo '<div class="phishing-tendency ' . $tendencyClass . '">' . $tendencyText . '</div>';
|
echo '<div class="phishing-tendency ' . $tendencyClass . '">' . $tendencyText . '</div>';
|
||||||
@ -195,13 +237,12 @@
|
|||||||
}
|
}
|
||||||
echo '</div>'; // Ende result-section
|
echo '</div>'; // Ende result-section
|
||||||
|
|
||||||
// Zurück-Button nach den Ergebnissen
|
|
||||||
echo '<div class="form-group" style="margin-top: 30px;">';
|
|
||||||
echo '<a href="index.php" class="back-button">Neue Analyse starten</a>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="error"><p>Fehler beim Laden der Analyse-Ergebnisse.</p></div>';
|
echo '<div class="error"><p>Fehler beim Laden der Analyse-Ergebnisse.</p></div>';
|
||||||
|
// Auch hier den Zurück-Button anzeigen, falls ein Fehler auftritt
|
||||||
|
echo '<div class="form-group" style="margin-top: 30px;">';
|
||||||
|
echo '<a href="index.php" class="back-button">Zurück zum Upload</a>';
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
} elseif (isset($_GET['error'])) {
|
} elseif (isset($_GET['error'])) {
|
||||||
echo '<div class="error"><p>' . htmlspecialchars($_GET['error']) . '</p></div>';
|
echo '<div class="error"><p>' . htmlspecialchars($_GET['error']) . '</p></div>';
|
||||||
@ -210,17 +251,98 @@
|
|||||||
echo '<a href="index.php" class="back-button">Zurück zum Upload</a>';
|
echo '<a href="index.php" class="back-button">Zurück zum Upload</a>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else {
|
} else {
|
||||||
// Zeige das Upload-Formular, wenn keine Ergebnisse oder Fehler vorliegen
|
// Zeige das Drag & Drop Feld, wenn keine Ergebnisse oder Fehler vorliegen
|
||||||
?>
|
?>
|
||||||
<form action="process_email.php" method="post" enctype="multipart/form-data">
|
<form id="uploadForm" action="process_email.php" method="post" enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email_file">Wählen Sie eine E-Mail-Datei zum Hochladen aus (.eml oder .txt):</label>
|
<label for="email_file">Wählen Sie eine E-Mail-Datei zum Hochladen aus (.eml oder .txt) oder ziehen Sie sie hierher:</label>
|
||||||
<input type="file" id="email_file" name="email_file" accept=".eml,.txt" required>
|
<div id="drop-area" class="drop-area">
|
||||||
|
<input type="file" id="email_file" name="email_file" accept=".eml,.txt" required>
|
||||||
|
<p>Ziehen Sie Ihre E-Mail-Datei hierher oder klicken Sie, um sie auszuwählen.</p>
|
||||||
|
<div id="selectedFileName" class="file-name-display"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit">E-Mail analysieren</button>
|
<button type="submit" id="submitButton" disabled>E-Mail analysieren</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const dropArea = document.getElementById('drop-area');
|
||||||
|
const fileInput = document.getElementById('email_file');
|
||||||
|
const submitButton = document.getElementById('submitButton');
|
||||||
|
const selectedFileNameDisplay = document.getElementById('selectedFileName');
|
||||||
|
const uploadForm = document.getElementById('uploadForm');
|
||||||
|
|
||||||
|
// Verhindere Standard-Drag-Verhalten
|
||||||
|
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
||||||
|
dropArea.addEventListener(eventName, preventDefaults, false);
|
||||||
|
document.body.addEventListener(eventName, preventDefaults, false); // Für den gesamten Body
|
||||||
|
});
|
||||||
|
|
||||||
|
function preventDefaults(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight Drop Area, wenn Datei darüber gezogen wird
|
||||||
|
['dragenter', 'dragover'].forEach(eventName => {
|
||||||
|
dropArea.addEventListener(eventName, highlight, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
['dragleave', 'drop'].forEach(eventName => {
|
||||||
|
dropArea.addEventListener(eventName, unhighlight, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
function highlight() {
|
||||||
|
dropArea.classList.add('highlight');
|
||||||
|
}
|
||||||
|
|
||||||
|
function unhighlight() {
|
||||||
|
dropArea.classList.remove('highlight');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Dropped Files
|
||||||
|
dropArea.addEventListener('drop', handleDrop, false);
|
||||||
|
|
||||||
|
function handleDrop(e) {
|
||||||
|
const dt = e.dataTransfer;
|
||||||
|
const files = dt.files;
|
||||||
|
|
||||||
|
if (files.length > 0) {
|
||||||
|
fileInput.files = files; // Weise die gedroppten Dateien dem Input-Feld zu
|
||||||
|
updateFileNameDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle File Selection via Klick
|
||||||
|
fileInput.addEventListener('change', updateFileNameDisplay);
|
||||||
|
|
||||||
|
function updateFileNameDisplay() {
|
||||||
|
if (fileInput.files.length > 0) {
|
||||||
|
const fileName = fileInput.files[0].name;
|
||||||
|
const fileExtension = fileName.split('.').pop().toLowerCase();
|
||||||
|
const allowedExtensions = ['eml', 'txt'];
|
||||||
|
|
||||||
|
if (allowedExtensions.includes(fileExtension)) {
|
||||||
|
selectedFileNameDisplay.textContent = `Ausgewählte Datei: ${fileName}`;
|
||||||
|
submitButton.disabled = false; // Aktiviere den Submit-Button
|
||||||
|
// Optional: Füge hier eine visuelle Bestätigung hinzu
|
||||||
|
} else {
|
||||||
|
selectedFileNameDisplay.textContent = `Ungültiger Dateityp: ${fileName}. Bitte .eml oder .txt wählen.`;
|
||||||
|
submitButton.disabled = true; // Deaktiviere den Submit-Button
|
||||||
|
alert('Ungültiger Dateityp. Bitte laden Sie eine .eml- oder .txt-Datei hoch.');
|
||||||
|
fileInput.value = ''; // Setze das Feld zurück
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedFileNameDisplay.textContent = '';
|
||||||
|
submitButton.disabled = true; // Deaktiviere den Submit-Button
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialer Zustand: Button deaktiviert
|
||||||
|
updateFileNameDisplay(); // Überprüft, ob beim Laden bereits eine Datei ausgewählt ist (unwahrscheinlich)
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user