1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-19 15:11:40 +02:00

Fix secret URL stats and fix 404

This commit is contained in:
Chaoyi Zha 2015-04-01 13:02:49 +00:00
parent af2419f946
commit a46a1ce680
2 changed files with 17 additions and 10 deletions

11
r.php
View File

@ -17,22 +17,23 @@ $result = $mysqli->query($query) or showerror();
$row = mysqli_fetch_assoc($result);
if (!$row['rurl']) {
if (!isset($row['rurl']) || strlen($row['rurl']) < 1) {
header("Location: 404.php", true, 302);
die();
}
if (strtolower($row['rurl']) == "disabled") {
require_once 'layout-headerlg.php';
echo "<h2>The link you are trying to reach has been disabled.</h2><br>"
. "Sorry for the inconvienience.";
require_once 'layout-footerlg.php';
die();
}
$lkey = @$row['lkey'];
if (strlen($lkey)>1) {
// Key needed? Check for it
if (strlen($lkey) > 1) {
// check for key
$sent_lkey = isset($_GET[$lkey]);
if ($sent_lkey) {
// yup, right key...continue on
// correct key
}
else {
require_once('layout-headerlg.php');

View File

@ -7,18 +7,24 @@ if (is_string($_GET['bv']) && ctype_alnum($_GET['bv'])) {
require_once 'layout-footerlg.php';
die();
}
$query = "SELECT `clicks`,`country`,`rurl` FROM redirinfo WHERE baseval='{$bv}';";
$query = "SELECT `clicks`,`country`,`rurl`,`lkey` FROM redirinfo WHERE baseval='{$bv}';";
$result = $mysqli->query($query);
$row = mysqli_fetch_assoc($result);
if(!$row) {
if(isset($row['lkey']) == true && strlen($row['lkey']) > 0) {
echo "<h3>Cannot show stats for a secret URL</h3>";
die();
}
if(!isset($row)) {
echo "404 Not Found";
require_once 'layout-footerlg.php';die();
require_once 'layout-footerlg.php';
die();
}
if(!$row['user']) {
if(!isset($row['user']) || strlen($row['user']) < 1) {
$row['user'] = '<i>Anonymous</i>';
}
if(!$row['country']) {
if(!isset($row['country']) || strlen($row['country']) < 1) {
$row['country'] = '<i>Unknown</i>';
}