Ejemplo n.º 1
0
function hnngRevealUrl($url)
{
    global $db, $hnngConf;
    if (strpos(dirname($url), $hnngConf['siteroot_short']) === false && strpos(dirname($url), $hnngConf['siteroot']) === false) {
        return 'Not a valid hnng.moe short link';
    }
    $exp = explode('/', $url);
    $id = $exp[count($exp) - 1];
    $url = hnngGetUrlById($id);
    if ($url == null) {
        return 'URL not found';
    }
    return $url;
}
Ejemplo n.º 2
0
/*
    Copyright 2014 Franc[e]sco (lolisamurai@tfwno.gf)
    This file is part of hnng.moe.
    hnng.moe is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    hnng.moe is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with hnng.moe. If not, see <http://www.gnu.org/licenses/>.
*/
define('hnngAllowInclude', true);
define('hnngRoot', realpath(dirname(__FILE__)) . '/');
require_once hnngRoot . 'includecheck.php';
require_once hnngRoot . 'dbmanager.php';
require_once hnngRoot . 'conf.php';
require_once hnngRoot . 'utils.php';
$_GET = hnngSanitizeArray($_GET);
$id = $_GET['urlid'];
$url = hnngGetUrlById($id);
if (!isset($url)) {
    header('HTTP/1.0 404 Not Found', true, 404);
    $_GET['act'] = 'notfound';
    include hnngRoot . 'index.php';
    exit;
}
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $url);