2014-02-14 16:02:59 +01:00
|
|
|
<?php
|
2014-06-21 15:27:18 +02:00
|
|
|
//Polr Redirector Core
|
2014-02-14 16:02:59 +01:00
|
|
|
require_once('req.php');
|
2014-06-21 15:27:18 +02:00
|
|
|
if (is_string($_GET['u'])) {
|
2014-02-14 16:02:59 +01:00
|
|
|
$val = $mysqli->real_escape_string($_GET['u']);
|
2014-06-21 15:27:18 +02:00
|
|
|
} else {
|
2014-02-14 16:02:59 +01:00
|
|
|
echo "Sorry. You didn't enter a string.";
|
|
|
|
die();
|
|
|
|
}
|
2014-06-21 15:27:18 +02:00
|
|
|
|
|
|
|
if (strstr($val, "t-")) {
|
2014-11-08 16:10:31 +01:00
|
|
|
$query = "SELECT `rurl` FROM `redirinfo-temp` WHERE baseval='{$val}'";
|
2014-06-21 15:27:18 +02:00
|
|
|
} else {
|
2014-11-08 16:10:31 +01:00
|
|
|
$query = "SELECT `rurl`,`lkey` FROM `redirinfo` WHERE baseval='{$val}'";
|
2014-06-21 15:27:18 +02:00
|
|
|
}
|
2014-02-14 16:02:59 +01:00
|
|
|
$result = $mysqli->query($query) or showerror();
|
|
|
|
|
|
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
|
2014-06-21 15:27:18 +02:00
|
|
|
|
|
|
|
if (!$row['rurl']) {
|
|
|
|
header("Location: 404.php", true, 302);
|
|
|
|
}
|
|
|
|
if (strtolower($row['rurl']) == "disabled") {
|
|
|
|
require_once 'header.php';
|
2014-11-20 22:36:27 +01:00
|
|
|
echo "<h2>The link you are trying to reach has been disabled.</h2><br>"
|
2014-06-21 15:27:18 +02:00
|
|
|
. "Sorry for the inconvienience.";
|
|
|
|
require_once 'footer.php';
|
2014-02-14 16:02:59 +01:00
|
|
|
}
|
2014-11-08 16:10:31 +01:00
|
|
|
$lkey = @$row['lkey'];
|
|
|
|
if (strlen($lkey)>1) {
|
|
|
|
// Key needed? Check for it
|
|
|
|
$sent_lkey = isset($_GET[$lkey]);
|
|
|
|
if ($sent_lkey) {
|
|
|
|
// yup, right key...continue on
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
require_once('header.php');
|
|
|
|
echo "Incorrect Key. (http://{$wsa}/abc?keyhere)";
|
|
|
|
require_once('footer.php');
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
}
|
2014-06-21 15:27:18 +02:00
|
|
|
header("Location: {$row['rurl']}", true, 301);
|
|
|
|
$oldclicks = sqlfetch("redirinfo", "clicks", "baseval", $val);
|
|
|
|
$newclicks = $oldclicks + 1;
|
|
|
|
sqlrun("UPDATE redirinfo SET clicks='{$newclicks}' WHERE baseval='{$val}'");
|