From 2072b5049fe2ae61b4dde9d21d5f15a22a0f78e2 Mon Sep 17 00:00:00 2001 From: wibyweb <49052850+wibyweb@users.noreply.github.com> Date: Mon, 20 Mar 2023 02:20:36 -0400 Subject: [PATCH] Add files via upload --- html/tags/tags.php | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/html/tags/tags.php b/html/tags/tags.php index 9bba90e..94349d2 100644 --- a/html/tags/tags.php +++ b/html/tags/tags.php @@ -41,13 +41,29 @@ $status = ""; if( isset($_POST['tags'])) - { + { $tags = mysqli_real_escape_string($link, $_POST['tags']); + + $result = mysqli_query($link,"SELECT id, shard FROM windex WHERE url = '".$url."'"); + if ($result === false) + { + $error = 'Error: ' . mysqli_error($link); + include 'error.html.php'; + exit(); + } + while($row = mysqli_fetch_array($result)) + { + $idArray[] = $row['id']; + $shardArray[] = $row['shard']; + } + $id = $idArray[0]; + $shard = $shardArray[0]; + if($tags==""){ - $result = mysqli_query($link,"UPDATE windex SET tags = NULL WHERE url = '".$url."';"); + $result = mysqli_query($link,"UPDATE windex SET tags = NULL WHERE id = $id AND url = '".$url."'"); } else{ - $result = mysqli_query($link,"UPDATE windex SET tags = '".$tags."' WHERE url = '".$url."';"); + $result = mysqli_query($link,"UPDATE windex SET tags = '".$tags."' WHERE id = $id AND url = '".$url."'"); } if ($result === false) { @@ -55,11 +71,25 @@ include 'error.html.php'; exit(); } + + if($tags==""){ + $result = mysqli_query($link,"UPDATE ws$shard SET tags = NULL WHERE id = $id AND url = '".$url."'"); + } + else{ + $result = mysqli_query($link,"UPDATE ws$shard SET tags = '".$tags."' WHERE id = $id AND url = '".$url."'"); + } + if ($result === false) + { + $error = 'Error fetching index: ' . mysqli_error($link); + include 'error.html.php'; + exit(); + } + $status = "Update Completed"; unset($_POST['tags']); } - $result = mysqli_query($link,"SELECT tags FROM windex WHERE url = '".$url."';"); + $result = mysqli_query($link,"SELECT tags FROM windex WHERE url = '".$url."'"); if ($result === false) { $error = 'Error fetching index: ' . mysqli_error($link);