Example #1
0
function do_redirect($code, $noredirect = 0)
{
    if ($noredirect) {
        return;
    }
    $url = get_url($code);
    if (empty($url)) {
        return;
    }
    if (lookup_url_is_spam($url)) {
        return;
    }
    if (check4spam($url)) {
        add_bad_url_to_db($url);
        return;
    }
    increase_clicks($code);
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Pragma: no-cache");
    header('Location: ' . $url, true, 301);
    exit(0);
}
Example #2
0
function blacklist_code($code, $reason = 'unwanted')
{
    if (empty($code)) {
        return false;
    }
    $url = get_url($code);
    if (empty($url)) {
        return false;
    }
    if (lookup_url_is_spam($url)) {
        return true;
    }
    $ip = get_IP();
    if (block_url($code, $url, $reason, $ip)) {
        return true;
    }
    return false;
}
Example #3
0
function process_code($code)
{
    $url = null;
    if (empty($code)) {
        return -1;
    }
    $url = get_url($code);
    if (empty($url)) {
        return -1;
    }
    $response = verify_url($url);
    if ($response != null) {
        if ($response == 404) {
            return 2;
        }
    } else {
        return -1;
    }
    if (lookup_url_is_spam($url)) {
        return 1;
    }
    if (check4spam($url)) {
        add_bad_url_to_db($url);
        return 1;
    }
    return 0;
}