Skip to content

Commit

Permalink
chore: change filtering priority
Browse files Browse the repository at this point in the history
  • Loading branch information
JinseoMyeon committed Sep 6, 2022
1 parent 525ab95 commit 07832d5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions functions/UrlShortener.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ function pingDomain($domain) {

$orignalURL = trim($orignalURL);

if ($getFilter->num_rows > 0) {
header("Location: ../index.php?error=filter");
$updateInDatabase = $this->db->query("UPDATE link_censored SET counts = counts + 1 WHERE url LIKE '%$pingURL[0]%'");
die();
}

$pingURL = str_replace("https://", "", $orignalURL);
$pingURL = str_replace("http://", "", $pingURL);
$pingURL = explode('/',$pingURL);
Expand All @@ -94,12 +100,6 @@ function pingDomain($domain) {
}
*/

else if ($getFilter->num_rows > 0) {
header("Location: ../index.php?error=filter");
$updateInDatabase = $this->db->query("UPDATE link_censored SET counts = counts + 1 WHERE url LIKE '%$pingURL[0]%'");
die();
}

else {
$orignalURL = $this->db->real_escape_string($orignalURL);
$existInDatabase = $this->db->query("SELECT * FROM link WHERE url ='{$orignalURL}'");
Expand Down Expand Up @@ -152,13 +152,19 @@ function pingDomain($domain) {
$orignalURL = trim($orignalURL);
$customUniqueCode = trim($customUniqueCode);

$getFilter = $this->db->query("SELECT * FROM link_censored WHERE url LIKE '%$pingURL[0]%'");

if ($getFilter->num_rows > 0) {
header("Location: ../index.php?error=filter");
$updateInDatabase = $this->db->query("UPDATE link_censored SET counts = counts + 1 WHERE url LIKE '%$pingURL[0]%'");
die();
}

$pingURL = str_replace("https://", "", $orignalURL);
$pingURL = str_replace("http://", "", $pingURL);
$pingURL = explode('/',$pingURL);
$pingResult = pingDomain($pingURL[0]);

$getFilter = $this->db->query("SELECT * FROM link_censored WHERE url LIKE '%$pingURL[0]%'");

if(strpos(strtolower($orignalURL), "https://ssib.al/") !== false) {
header("Location: ../index.php?error=recursion");
die();
Expand All @@ -174,12 +180,6 @@ function pingDomain($domain) {
die();
}

else if ($getFilter->num_rows > 0) {
header("Location: ../index.php?error=filter");
$updateInDatabase = $this->db->query("UPDATE link_censored SET counts = counts + 1 WHERE url LIKE '%$pingURL[0]%'");
die();
}

/* 접속 요청을 보내는 코드 완성 이전까지 임시 사용.
else if (strpos(strtolower($orignalURL), "https://https://") !== false || strpos(strtolower($orignalURL), "https://http://") !== false) {
header("Location: ../index.php?error=inurl");
Expand Down

0 comments on commit 07832d5

Please sign in to comment.