mirror of
				https://github.com/Alamantus/Lexiconga.git
				synced 2025-11-04 02:07:05 +01:00 
			
		
		
		
	Strip tags before parsing json in api request
This commit is contained in:
		
							parent
							
								
									3666acc426
								
							
						
					
					
						commit
						33ac88dd6c
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -3,8 +3,17 @@ require_once('./Response.php');
 | 
			
		|||
require_once('./User.php');
 | 
			
		||||
 | 
			
		||||
$inputJSON = file_get_contents('php://input');
 | 
			
		||||
$inputJSON = strip_tags($inputJSON);
 | 
			
		||||
$request= json_decode($inputJSON, true);
 | 
			
		||||
 | 
			
		||||
if (!$request) {
 | 
			
		||||
  // If malformed/unparseable JSON, fail.
 | 
			
		||||
  return Response::json(array(
 | 
			
		||||
    'data' => 'Malformed request data',
 | 
			
		||||
    'error' => true,
 | 
			
		||||
  ), 400);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$action = isset($request['action']) ? $request['action'] : '';
 | 
			
		||||
$token = isset($_COOKIE['token']) ? $_COOKIE['token'] : false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue