aboutsummaryrefslogtreecommitdiff
path: root/admin/api/deleteURL.php
blob: 895751e8e4e0fc2f1ffb14fa2bc2265a0b092957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";

if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
    $arg = $_GET['_'];
} else {
    die();
}

$urls = explode("\n", file_get_contents("/mnt/minteckrolt-urls/links.txt"));
$newUrlsArr = [];

foreach ($urls as $url) {
    if (explode(" ", $url)[0] !== $arg) {
        $newUrlsArr[] = $url;
    }
}

file_put_contents("/mnt/minteckrolt-urls/links.txt", implode("\n", $newUrlsArr));

header("Location: /admin/panes/shortens.php");
die();