-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredirect.php
More file actions
62 lines (55 loc) · 2.16 KB
/
Copy pathredirect.php
File metadata and controls
62 lines (55 loc) · 2.16 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
include 'db.php';
// Kısa URL parametresini al
if (isset($_GET['short_url'])) {
$short_url = $_GET['short_url'];
// Veritabanında kısa URL'yi ara
$sql = "SELECT id, original_url FROM links WHERE short_url = '$short_url'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
// Tıklama sayısını artır
$sql_update = "UPDATE links SET clicks = clicks + 1 WHERE id = " . $row['id'];
$conn->query($sql_update);
// Kullanıcıyı orijinal URL'ye yönlendir
header("Location: " . $row['original_url']);
exit();
} else {
$error_message = "Link bulunamadı.";
}
} else {
$error_message = "Kısa link parametresi eksik.";
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yönlendiriliyor...</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="page-wrapper">
<div class="login-wrapper">
<?php if (isset($error_message)) { ?>
<div class="card text-center" style="max-width: 500px;">
<div class="brand-header">
<span class="brand-logo" style="font-size: 1.25rem;">Beykoz Üniversitesi Kısa Link Servisi</span>
</div>
<div class="alert alert-danger mb-2">
<?php echo $error_message; ?>
</div>
<p class="mb-2" style="color: var(--text-muted);">Görünüşe göre bu link artık aktif değil veya hatalı bir adrese geldiniz.</p>
<a href="https://www.beykoz.edu.tr" class="btn btn-primary" target="_blank">
www.beykoz.edu.tr adresine git
</a>
</div>
<?php } ?>
</div>
<footer class="footer">
<p>Bu proje CC BY-NC-SA 4.0 Lisansı ile lisanslanmıştır — Beykoz Üniversitesi Bilgi İşlem Direktörlüğü</p>
</footer>
</div>
</body>
</html>