-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatistics.php
More file actions
157 lines (149 loc) 路 7.25 KB
/
Copy pathstatistics.php
File metadata and controls
157 lines (149 loc) 路 7.25 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
include "connection/connection.php";
if (!isset($_SESSION['id'])) {
// Redirect the user to the login page
header("Location: login.php");
exit(); // Stop script execution
}
$correo = $_SESSION['email'];
if (!empty($correo)) {
// Query to get user links
$sql = "SELECT short_id, original_url, created_at FROM urls WHERE user_email = '$correo'";
$result = $conn->query($sql);
} else {
echo "The email is not defined.";
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-icon" sizes="76x76" href="../assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="../assets/img/favicon.png">
<title>
Statistics - Link Shortener
</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
<!-- Nucleo Icons -->
<link href="https://demos.creative-tim.com/argon-dashboard-pro/assets/css/nucleo-icons.css" rel="stylesheet" />
<link href="https://demos.creative-tim.com/argon-dashboard-pro/assets/css/nucleo-svg.css" rel="stylesheet" />
<!-- Font Awesome Icons -->
<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
<!-- CSS Files -->
<link id="pagestyle" href="css/assets/css/argon-dashboard.css?v=2.1.0" rel="stylesheet" />
</head>
<body class="g-sidenav-show bg-gray-100">
<?php include "inc/menu.php" ?>
<main class="main-content position-relative border-radius-lg ">
<!-- Navbar -->
<nav class="navbar navbar-main navbar-expand-lg px-0 mx-4 shadow-none border-radius-xl " id="navbarBlur" data-scroll="false">
<div class="container-fluid py-1 px-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb bg-transparent mb-0 pb-0 pt-1 px-0 me-sm-6 me-5">
<li class="breadcrumb-item text-sm"><a class="opacity-5 text-white" href="javascript:;">Pages</a></li>
<li class="breadcrumb-item text-sm text-white active" aria-current="page">statistics</li>
</ol>
<h6 class="font-weight-bolder text-white mb-0">statistics</h6>
</nav>
</div>
</div>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- End Navbar -->
<div class="container-fluid py-4">
<div class="row">
<div class="col-12">
<div class="card mb-4">
<div class="card-header pb-0">
<h6>Url Links</h6>
</div>
<div class="card-body px-0 pt-0 pb-2">
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
<thead>
<tr>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Url</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Url Short</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Status</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Create</th>
<th class="text-secondary opacity-7"></th>
</tr>
</thead>
<tbody>
<?php if ($result && $result->num_rows > 0): ?>
<?php while ($row = $result->fetch_assoc()): ?>
<tr>
<td>
<div class="d-flex px-2 py-1">
<div class="d-flex flex-column justify-content-center">
<h6 class="mb-0 text-sm">
<a href="<?= $row['original_url'] ?>" target="_blank" title="<?= $row['original_url'] ?>">
<?= strlen($row['original_url']) > 20 ? substr($row['original_url'], 0, 20) . '...' : $row['original_url'] ?>
</a>
</h6>
</div>
</div>
</td>
<td>
<p class="text-xs font-weight-bold mb-0">
<a href="redirect.php?id=<?= $row['short_id'] ?>" target="_blank"><?= $row['short_id'] ?></a>
</p>
</td>
<td class="align-middle text-center text-sm">
<span class="badge badge-sm bg-gradient-success">Active</span>
</td>
<td class="align-middle text-center">
<span class="text-secondary text-xs font-weight-bold"><?= date("d/m/Y", strtotime($row['created_at'])) ?></span>
</td>
<td class="align-middle">
<a href="statisticsurl.php?id=<?= $row['short_id'] ?>"
class="text-secondary font-weight-bold text-xs"
data-toggle="tooltip"
data-original-title="View statistics">
Statistics
</a>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">No links found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="css/assets/js/core/popper.min.js"></script>
<script src="css/assets/js/core/bootstrap.min.js"></script>
<script src="css/assets/js/plugins/perfect-scrollbar.min.js"></script>
<script src="css/assets/js/plugins/smooth-scrollbar.min.js"></script>
<script>
var win = navigator.platform.indexOf('Win') > -1;
if (win && document.querySelector('#sidenav-scrollbar')) {
var options = {
damping: '0.5'
}
Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
}
</script>
<!-- Github buttons -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<!-- Control Center for Soft Dashboard: parallax effects, scripts for the example pages etc -->
<script src="../assets/js/argon-dashboard.min.js?v=2.1.0"></script>
</body>
</html>