-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr.php
More file actions
27 lines (22 loc) · 679 Bytes
/
r.php
File metadata and controls
27 lines (22 loc) · 679 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
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once __DIR__ . '/libs/core/config.php';
require_once __DIR__ . '/libs/core/db_connection.php';
if (!isset($_GET["c"])) {
die("❌ Kein Code angegeben.");
}
$code = trim($_GET["c"]);
try {
$stmt = $pdo->prepare("SELECT url FROM short_urls WHERE code = ?");
$stmt->execute([$code]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row && isset($row["url"])) {
header("Location: " . $row["url"]);
exit;
} else {
die("❌ Kurz-URL nicht gefunden.");
}
} catch (PDOException $e) {
die("❌ Datenbankfehler: " . $e->getMessage());
}