mirror of
				https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
				synced 2025-10-31 03:50:20 -04:00 
			
		
		
		
	Fix for status api by correcting sql queries
This commit is contained in:
		
							parent
							
								
									58b375161d
								
							
						
					
					
						commit
						002bb13e10
					
				| @ -15,7 +15,8 @@ else{ | |||||||
| 	  $array = $constellation->render_status(true, false); | 	  $array = $constellation->render_status(true, false); | ||||||
| 	  echo json_encode($array); | 	  echo json_encode($array); | ||||||
|   }else{ |   }else{ | ||||||
|     $queryId = $mysqli->prepare("SELECT id as 'id' from services where id = ?;"); |     // get id of service, check if service exists
 | ||||||
|  |     $queryId = $mysqli->prepare("SELECT id from services where id = ?;"); | ||||||
|     $queryId->bind_param("i", $_GET['id']); |     $queryId->bind_param("i", $_GET['id']); | ||||||
|     $queryId->execute(); |     $queryId->execute(); | ||||||
|     $result = $queryId->get_result()->fetch_assoc(); |     $result = $queryId->get_result()->fetch_assoc(); | ||||||
| @ -23,12 +24,12 @@ else{ | |||||||
|     { |     { | ||||||
|     	die(json_encode(["error" => _("Service does not exist!")])); |     	die(json_encode(["error" => _("Service does not exist!")])); | ||||||
|     } |     } | ||||||
| 
 |     // get name, description and status.type (status of service) by id
 | ||||||
|   	$query = $mysqli->prepare("select services.id, name, description, status.type from services inner join status on status.id = services.id where services.id = ?;"); |   	$query = $mysqli->prepare("select services.id, name, description, status.type from services inner join status on status.id = services.id where services.id = ?;"); | ||||||
|   	$query->bind_param("i", $_GET['id']); |   	$query->bind_param("i", $_GET['id']); | ||||||
|   	$query->execute(); |   	$query->execute(); | ||||||
|     $result = $query->get_result()->fetch_assoc(); |     $result = $query->get_result()->fetch_assoc(); | ||||||
| 
 |     // if type is a number then return it, else just return the service name/desc
 | ||||||
|     if (is_numeric($result["type"])) { |     if (is_numeric($result["type"])) { | ||||||
|       $service = new Service($_GET["id"], $result["name"], $result["description"], '', $result["type"]); |       $service = new Service($_GET["id"], $result["name"], $result["description"], '', $result["type"]); | ||||||
|     } else { |     } else { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user