  def on_moved
    Log.add_info(request, params.inspect)

    return unless request.post?

    location_id = params[:id]
    SqlHelper.validate_token([location_id])

    if location_id.blank?
      location = Location.get_for(@login_user)
      if location.nil?
        location = Location.new
        location.user_id = @login_user.id
      end
    else
      begin
        location = Location.find(location_id)
      rescue
        location = nil
      end
    end

    unless location.nil?
      group_id = params[:group_id]
      group_id = nil if group_id.empty?
      SqlHelper.validate_token([group_id])
      attrs = ActionController::Parameters.new({group_id: group_id, x: params[:x], y: params[:y]})
      location.update_attributes(attrs.permit(Location::PERMIT_BASE))
    end

    render(:text => (location.nil?)?'':location.id.to_s)
  end
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.