$val) { $u = mysqli_real_escape_string($conn, $key); $new_url = str_replace('/', '', $u); } // Query the database for the full URL associated with the shortened URL $sql = mysqli_query($conn, "SELECT full_url FROM url WHERE shorten_url = '{$new_url}'"); if (mysqli_num_rows($sql) > 0) { // Increment the click count for the shortened URL $sql2 = mysqli_query($conn, "UPDATE url SET clicks = clicks + 1 WHERE shorten_url = '{$new_url}'"); if ($sql2) { // Fetch the full URL and redirect to it $full_url = mysqli_fetch_assoc($sql); header("Location:" . $full_url['full_url']); exit(); // Stop further script execution after redirection } } } ?> Xeorl - Link Shortener and Management Tool

Open source inits.

Lovingly hand-crafted.

Premium link shortening for use in web, iOS, Android, and
desktop apps. Supported for urls. Completely open source, MIT
licensed and built by xodivorce.