-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcron.php
More file actions
37 lines (28 loc) · 857 Bytes
/
cron.php
File metadata and controls
37 lines (28 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
// Fehleranzeige aktivieren
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Konfiguration und Klassen laden
require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/src/Logger.php';
require_once __DIR__ . '/src/Bot.php';
use DreiBot\Logger;
use DreiBot\Bot;
// Konfiguration laden
$config = require __DIR__ . '/config/config.php';
Logger::init($config);
// Zugriffsschutz per Secret
$provided = $_GET['secret'] ?? '';
$expected = $config['cronjob_secret'] ?? '';
if ($provided !== $expected) {
Logger::warn("Unberechtigter Zugriff auf cron.php mit Secret: '$provided'");
http_response_code(403);
echo "Zugriff verweigert.";
exit;
}
// Bot starten
Logger::log("cron.php gestartet mit gültigem Secret.");
$bot = new Bot();
$bot->run();
echo "Botlauf abgeschlossen.";