summaryrefslogtreecommitdiff
path: root/linkshorter/goto.php
blob: f459dc6e933859ee0478bb78914bb3638a4a2aeb (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
<?php

require '../tools/class/redis.php';
require 'config.php';
require 'functions.php';

if ( ! isset($_REQUEST["short"]) || $_REQUEST["short"] == "" ){
	header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
	_do_output("Failure!", "Requested ID not found.");
}

$db = new Database(REDIS_CONNECT, REDIS_SELECT);

if ( ! $db->exists($_REQUEST["short"])){
	
	require 'view/templ-notfound.php';

} else {
	$options = json_decode( $db->get($_REQUEST["short"]), true );

	if ( $options["password"] == "" ){
		redirect($options["url"]);
	} else {
		require 'view/templ-password.php';
	}
}