	public static function available($username, $website_id)
	{
		global $DB;
		
		// remove spaces and make username lowercase (only to compare case insensitive)
		$username = trim($username);
		$username = mb_strtolower($username);
	
		$data = NULL;
		if($DB->query('SELECT COUNT(*) as total
					   FROM nv_webusers 
					   WHERE LOWER(username) = '.protect($username).'
					   	 AND website = '.$website_id))
		{
			$data = $DB->first();
		}
		
		return ($data->total <= 0);
	}

The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.