This repository has been archived by the owner on Feb 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.php
102 lines (93 loc) · 2.91 KB
/
index.php
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
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);
// Define PHURL to allow includes
define('PHURL', true);
require_once("../includes/config.php");
require_once("../includes/functions.php");
db_connect();
require_login();
$WORKING_DIR = '../';
if (file_exists("../".get_phurl_option('theme_path') . "header.php")) {
include ("../".get_phurl_option('theme_path') . "header.php");
} else {
die ("<h2>Could not load theme</h2>");
}
print_errors();
$db_query = "WHERE ";
$list = "";
if (is_admin_login() && isset($_GET['list']) && $_GET['list'] == "all") {
$db_query = "";
$user = "everyone";
$list = "all";
} else {
$db_query .= "api='".$_USER['apiKey']."'";
$user = $_USER['uname'];
}
$db_start = 0;
$db_result = mysql_query("SELECT id,uname,apiKey FROM ".DB_PREFIX."users");
while ($db_row = mysql_fetch_assoc($db_result)) {
$userApiLookup[$db_row['apiKey']] = $db_row['uname'];
if ($db_row['id'] == 1) {
$userApiLookup[$db_row['apiKey']] = "User not logged in";
}
}
?>
<div id="panel">
Listing urls created by <?php echo $user; ?>.<br />
<?php
$db_result = mysql_query("SELECT * FROM ".DB_PREFIX."urls $db_query ORDER BY date_added DESC LIMIT $db_start, 25") or db_die(__FILE__, __LINE__, mysql_error());
echo "<table id=\"url_list\">\n";
echo "<tr>\n";
if (is_admin_login()) {
echo "<td><u>ID</td></u>\n";
}
echo "<td><u>Code</u></td>\n".
"<td><u>Alias</u></td>\n".
"<td><u>Long URL</u></td>\n".
"<td><u>Date Added</u></td>\n".
"<td><u>Expire date</u></td>\n".
"<td><u>View</u></td>\n";
if ($list == "all") {
echo "<td><u>User</u></td>\n";
}
echo "</tr>\n";
while ($db_row = mysql_fetch_assoc($db_result)) {
$db_row = array_filter($db_row, "stripslashes");
$u_api = "";
extract($db_row, EXTR_OVERWRITE|EXTR_PREFIX_ALL, "u");
if (check_expire($u_code) != true) {
if (empty($u_alias)) {
$u_alias = "";
}
if ($u_expire_date == "0000-00-00 00:00:00") {
$u_expire_date = "Never";
}
echo
"<tr>\n";
if (is_admin_login()) {
echo "<td>$u_id</td>\n";
}
echo "<td>$u_code</td>\n".
"<td>" . htmlentities($u_alias) . "</td>\n".
"<td>" . htmlentities($u_url) . "</td>\n".
"<td>$u_date_added</td>\n".
"<td>$u_expire_date</td>\n".
"<td><a href=\"/".$u_code."\" target=\"_blank\">Open</a> | <a href=\"/".$u_code."-\" target=\"_black\">Stats</a></td>\n";
if ($list == "all") {
echo "<td>".$userApiLookup[$u_api]."</td>\n";
}
echo "</tr>\n";
unset($u_id, $u_code, $u_alias, $u_url, $u_date_added, $u_api);
}
}
echo "</table>\n";
?>
</div>
<?php
if (file_exists("../".get_phurl_option('theme_path') . "footer.php")) {
include ("../".get_phurl_option('theme_path') . "footer.php");
} else {
die ("<h2>Could not load theme</h2>");
}
?>