Ejemplo n.º 1
0
<?php

// Always
header('Content-type: text/html; charset="utf-8"');
// Config
require 'inc.functions.php';
require 'inc.config.php';
ini_set('date.timezone', 'Europe/Amsterdam');
error_reporting(E_ALL & ~E_STRICT);
// Database
require 'inc.db.php';
if (!$db) {
    header('HTTP/1.1 500 Connection error', true, 500);
    exit('Connection error');
}
// Xnary
require 'Xnary.php';
Xnary::$range = implode(range('A', 'Z')) . implode(range('0', '9'));
Ejemplo n.º 2
0
if (isset($_REQUEST['url'], $_REQUEST['title'], $_REQUEST['tags'])) {
    exit(_AddLink($_REQUEST['url'], $_REQUEST['title'], $_REQUEST['tags']));
} else {
    if (isset($_REQUEST['url'], $_REQUEST['tags'])) {
        exit(CopyUrlToTags((int) $_REQUEST['url'], $_REQUEST['tags']));
    } else {
        if (isset($_REQUEST['url'], $_REQUEST['title'])) {
            exit(ChangeUrlTitle((int) $_REQUEST['url'], $_REQUEST['title']));
        } else {
            if (isset($_REQUEST['url'])) {
                header('Content-type: application/json; charset="utf-8"');
                exit(GetUrlUsage($_REQUEST['url']));
            } else {
                if (!empty($_GET['code'])) {
                    $code = strtoupper($_GET['code']);
                    $id = Xnary::toInt($code);
                    if ($url = $db->select_one('l_urls', 'url', array('id' => (int) $id))) {
                        header('Location: ' . $url);
                    }
                    exit('#' . $id);
                }
            }
        }
    }
}
// View tags //
$szTags = trim(@$_GET['tags']) ?: trim(@$_GET['t']) ?: '';
ViewUrlsByTag(valid_tags($szTags));
/**
 * Get URL usage from db
 */