Welcome to mirror list, hosted at ThFree Co, Russian Federation.

r.php - github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/r.php
blob: f2f056c5a34db1ab30e957fef5397c525d53e616 (plain)
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
<?php
//Polr Redirector Core
require_once('lib-core.php');
if (is_string($_GET['u'])) {
    $val = $mysqli->real_escape_string($_GET['u']);
} else {
    echo "Sorry. You didn't enter a string.";
    die();
}

if (strstr($val, "t-")) {
    $query = "SELECT `rurl` FROM `redirinfo-temp` WHERE baseval='{$val}'";
} else {
    $query = "SELECT `rurl`,`lkey` FROM `redirinfo` WHERE baseval='{$val}'";
}
$result = $mysqli->query($query) or showerror();

$row = mysqli_fetch_assoc($result);

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) {
	// check for key
	$sent_lkey = isset($_GET[$lkey]);
	if ($sent_lkey) {
		// correct key
	}
	else {
		require_once('layout-headerlg.php');
		echo "Incorrect Key. (http://{$wsa}/abc?keyhere)";
		require_once('layout-footerlg.php');
		die();
	}
}
header("Location: {$row['rurl']}", true, 301);
$oldclicks = sqlfetch("redirinfo", "clicks", "baseval", $val);
$newclicks = $oldclicks + 1;
sqlrun("UPDATE redirinfo SET clicks='{$newclicks}' WHERE baseval='{$val}'");