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); }
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; }