Browse Source

Add files via upload

wibyweb 2 năm trước cách đây
mục cha
commit
2072b5049f
1 tập tin đã thay đổi với 34 bổ sung4 xóa
  1. 34 4
      html/tags/tags.php

+ 34 - 4
html/tags/tags.php

@@ -41,13 +41,29 @@
 		$status = "";
 		$status = "";
 		
 		
 		if( isset($_POST['tags']))
 		if( isset($_POST['tags']))
-		{
+		{			
 			$tags = mysqli_real_escape_string($link, $_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==""){
 			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{
 			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)   
 			if ($result === false)   
 			{
 			{
@@ -55,11 +71,25 @@
 			  include 'error.html.php';  
 			  include 'error.html.php';  
 			  exit(); 
 			  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";
 			$status = "Update Completed";
 			unset($_POST['tags']);
 			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)  
 		if ($result === false)  
 		{
 		{
 		  $error = 'Error fetching index: ' . mysqli_error($link);  
 		  $error = 'Error fetching index: ' . mysqli_error($link);