update
This commit is contained in:
@@ -1,130 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Kontaktformular - Profice</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
|
|
||||||
.form-container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
|
|
||||||
.form-group { margin-bottom: 20px; }
|
|
||||||
label { display: block; margin-bottom: 5px; font-weight: bold; }
|
|
||||||
input, textarea, select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; }
|
|
||||||
textarea { height: 100px; resize: vertical; }
|
|
||||||
button { background: #007bff; color: white; padding: 12px 24px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; }
|
|
||||||
button:hover { background: #0056b3; }
|
|
||||||
.success { color: green; text-align: center; padding: 20px; }
|
|
||||||
.error { color: red; text-align: center; padding: 20px; }
|
|
||||||
.backup-info { background: #fff3cd; border: 1px solid #ffeaa7; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="form-container">
|
|
||||||
<h2>Kontaktformular (Backup)</h2>
|
|
||||||
|
|
||||||
<div class="backup-info">
|
|
||||||
<strong>Hinweis:</strong> Dies ist eine Backup-Version des Kontaktformulars. Wenn das Hauptformular nicht funktioniert, können Sie dieses verwenden.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form id="backupForm">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="name">Name *</label>
|
|
||||||
<input type="text" id="name" name="name" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="organisation">Organisation</label>
|
|
||||||
<input type="text" id="organisation" name="organisation">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="contact">E-Mail oder Telefonnummer *</label>
|
|
||||||
<input type="text" id="contact" name="contact" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="service">Gewünschte Dienstleistung *</label>
|
|
||||||
<select id="service" name="service" required>
|
|
||||||
<option value="">Bitte wählen...</option>
|
|
||||||
<option value="website">Website</option>
|
|
||||||
<option value="ki-integration">KI Integration</option>
|
|
||||||
<option value="automatisation">Automatisation</option>
|
|
||||||
<option value="unabhaengige-wahl">Unabhängige Wahl</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="budget">Budget (€)</label>
|
|
||||||
<input type="text" id="budget" name="budget" placeholder="z.B. 5000 - 10000">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="description">Beschreibung *</label>
|
|
||||||
<textarea id="description" name="description" required placeholder="Beschreiben Sie Ihr Projekt oder Ihre Anfrage..."></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit">Anfrage senden</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div id="result"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.getElementById('backupForm').addEventListener('submit', async function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const formData = new FormData(this);
|
|
||||||
const data = Object.fromEntries(formData);
|
|
||||||
data.type = 'contact';
|
|
||||||
|
|
||||||
const resultDiv = document.getElementById('result');
|
|
||||||
resultDiv.innerHTML = '<p style="text-align: center;">Sende Anfrage...</p>';
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Try main PHP endpoint first
|
|
||||||
const response = await fetch('scripts/add/send.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
const result = await response.json();
|
|
||||||
if (result.success) {
|
|
||||||
resultDiv.innerHTML = '<div class="success">Vielen Dank! Ihre Anfrage wurde erfolgreich gesendet. Wir melden uns bald bei Ihnen.</div>';
|
|
||||||
this.reset();
|
|
||||||
} else {
|
|
||||||
throw new Error(result.message || 'Unknown error');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error(`HTTP ${response.status}`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
// Fallback: Create mailto link
|
|
||||||
const subject = encodeURIComponent('Kontaktanfrage von Profice Website');
|
|
||||||
const body = encodeURIComponent(
|
|
||||||
`Name: ${data.name}\n` +
|
|
||||||
`Organisation: ${data.organisation || ''}\n` +
|
|
||||||
`Kontakt: ${data.contact}\n` +
|
|
||||||
`Dienstleistung: ${data.service}\n` +
|
|
||||||
`Budget: ${data.budget || ''}\n` +
|
|
||||||
`Beschreibung: ${data.description}`
|
|
||||||
);
|
|
||||||
|
|
||||||
const mailtoLink = `mailto:info@profice.de?subject=${subject}&body=${body}`;
|
|
||||||
|
|
||||||
resultDiv.innerHTML = `
|
|
||||||
<div class="error">
|
|
||||||
<p>Leider konnte die Anfrage nicht automatisch gesendet werden.</p>
|
|
||||||
<p>Bitte klicken Sie auf den untenstehenden Link, um Ihre E-Mail zu öffnen:</p>
|
|
||||||
<p><a href="${mailtoLink}" style="color: #007bff; text-decoration: underline;">E-Mail öffnen</a></p>
|
|
||||||
<p>Oder senden Sie eine E-Mail an: <strong>info@profice.de</strong></p>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -562,13 +562,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function testPHP() {
|
async function testPHP() {
|
||||||
logDebug('Testing PHP connection...');
|
logDebug('Testing PHP & Webhook...');
|
||||||
try {
|
try {
|
||||||
const response = await fetch('scripts/add/test.php');
|
const response = await fetch('scripts/add/test.php');
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
logDebug(`✓ PHP OK: ${result.message}`);
|
logDebug(`PHP: ${result.tests?.php?.version || 'OK'}`);
|
||||||
logDebug(`PHP Version: ${result.server_info?.php_version || 'Unknown'}`);
|
logDebug(`cURL: ${result.tests?.curl?.status || 'unknown'}`);
|
||||||
|
if (result.tests?.webhook) {
|
||||||
|
const wh = result.tests.webhook;
|
||||||
|
if (wh.status === 'ok') {
|
||||||
|
logDebug(`✓ Webhook: HTTP ${wh.http_code}`);
|
||||||
|
} else {
|
||||||
|
logDebug(`✗ Webhook: ${wh.error || 'HTTP ' + wh.http_code}`, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logDebug(`✗ PHP Error: HTTP ${response.status}`, true);
|
logDebug(`✗ PHP Error: HTTP ${response.status}`, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
define('USE_PRODUCTION', true); // Use production webhook for live server
|
define('USE_PRODUCTION', true); // Use production webhook for live server
|
||||||
define('DEBUG_MODE', false); // Disable debug for production
|
define('DEBUG_MODE', true); // Enable debug temporarily to see errors
|
||||||
|
|
||||||
// N8N Webhooks
|
// N8N Webhooks
|
||||||
define('WEBHOOK_TEST', 'https://n8n.profice.de/webhook-test/d94ef798-3f43-46dd-8207-1e335e64518f');
|
define('WEBHOOK_TEST', 'https://n8n.profice.de/webhook-test/d94ef798-3f43-46dd-8207-1e335e64518f');
|
||||||
@@ -193,18 +193,20 @@ function sendToWebhook($data, $webhookUrl = null) {
|
|||||||
'User-Agent: Profice-Web-API/2.0'
|
'User-Agent: Profice-Web-API/2.0'
|
||||||
],
|
],
|
||||||
CURLOPT_TIMEOUT => 30,
|
CURLOPT_TIMEOUT => 30,
|
||||||
CURLOPT_SSL_VERIFYPEER => !DEBUG_MODE, // Disable for debugging
|
CURLOPT_SSL_VERIFYPEER => false, // Disable SSL verification for n8n connection
|
||||||
|
CURLOPT_SSL_VERIFYHOST => false, // Disable host verification
|
||||||
CURLOPT_FOLLOWLOCATION => true
|
CURLOPT_FOLLOWLOCATION => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
$error = curl_error($ch);
|
$error = curl_error($ch);
|
||||||
|
$errno = curl_errno($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
error_log("Webhook Error: " . $error);
|
error_log("Webhook Error [$errno]: " . $error . " - URL: " . $url);
|
||||||
return ['success' => false, 'error' => $error, 'response' => $response];
|
return ['success' => false, 'error' => $error, 'errno' => $errno, 'response' => $response];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,13 +1,85 @@
|
|||||||
<?php
|
<?php
|
||||||
// Simple test file to verify PHP is working
|
// Comprehensive test file to verify PHP and webhook connectivity
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode([
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
|
||||||
|
$results = [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'PHP is working correctly',
|
|
||||||
'timestamp' => date('c'),
|
'timestamp' => date('c'),
|
||||||
'server_info' => [
|
'tests' => []
|
||||||
'php_version' => phpversion(),
|
];
|
||||||
'server_software' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'
|
|
||||||
]
|
// Test 1: PHP Version
|
||||||
]);
|
$results['tests']['php'] = [
|
||||||
?>
|
'status' => 'ok',
|
||||||
|
'version' => phpversion(),
|
||||||
|
'server' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Test 2: cURL Extension
|
||||||
|
$results['tests']['curl'] = [
|
||||||
|
'status' => extension_loaded('curl') ? 'ok' : 'error',
|
||||||
|
'message' => extension_loaded('curl') ? 'cURL extension loaded' : 'cURL extension NOT loaded - webhooks will fail!'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Test 3: JSON Extension
|
||||||
|
$results['tests']['json'] = [
|
||||||
|
'status' => extension_loaded('json') ? 'ok' : 'error',
|
||||||
|
'message' => extension_loaded('json') ? 'JSON extension loaded' : 'JSON extension NOT loaded'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Test 4: Test webhook connection
|
||||||
|
if (extension_loaded('curl')) {
|
||||||
|
$webhookUrl = 'https://n8n.profice.de/webhook/d94ef798-3f43-46dd-8207-1e335e64518f';
|
||||||
|
|
||||||
|
$testData = [
|
||||||
|
'type' => 'connection_test',
|
||||||
|
'timestamp' => date('c'),
|
||||||
|
'source' => 'test.php'
|
||||||
|
];
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_URL => $webhookUrl,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_POST => true,
|
||||||
|
CURLOPT_POSTFIELDS => json_encode($testData),
|
||||||
|
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
||||||
|
CURLOPT_TIMEOUT => 10,
|
||||||
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
|
CURLOPT_SSL_VERIFYHOST => false
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$error = curl_error($ch);
|
||||||
|
$errno = curl_errno($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$results['tests']['webhook'] = [
|
||||||
|
'status' => ($httpCode >= 200 && $httpCode < 300) ? 'ok' : 'error',
|
||||||
|
'http_code' => $httpCode,
|
||||||
|
'url' => $webhookUrl,
|
||||||
|
'error' => $error ?: null,
|
||||||
|
'error_code' => $errno ?: null,
|
||||||
|
'response_preview' => substr($response, 0, 200)
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$results['success'] = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$results['tests']['webhook'] = [
|
||||||
|
'status' => 'skipped',
|
||||||
|
'message' => 'cURL not available'
|
||||||
|
];
|
||||||
|
$results['success'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test 5: File permissions
|
||||||
|
$results['tests']['permissions'] = [
|
||||||
|
'status' => is_writable(dirname(__FILE__)) ? 'ok' : 'warning',
|
||||||
|
'message' => is_writable(dirname(__FILE__)) ? 'Directory writable' : 'Directory not writable (may affect logging)'
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($results, JSON_PRETTY_PRINT);
|
||||||
|
|||||||
Reference in New Issue
Block a user